hln_01
asked on
Nohup problem in crontab
How to schedule a cronjob with nohup to run on particular time? For example like this :where the job is running on different directory as the crontab.
15 8 * * * nohup ./tmp/jobs/startjob &
is this the right way to do it?
I'd try but not working at all.....
please do assist.
Thanks
15 8 * * * nohup ./tmp/jobs/startjob &
is this the right way to do it?
I'd try but not working at all.....
please do assist.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
15 8 * * * /tmp/cronjob.sh >>/tmp/cronjob.log 2>&1
Why I need this >>/tmp/cronjob.log 2>&1 after my script?
And what does this &1 mean?
Why I need this >>/tmp/cronjob.log 2>&1 after my script?
And what does this &1 mean?
ASKER
How can I quit my script while the nohup job is actually running?
"...Why I need this >>/tmp/cronjob.log 2>&1 after my script?..."
--> This prevents any outputmail to be send to the cronjob owner? This is not required.
"...And what does this &1 mean?..."
--> This means all errors are redirected to the same file as non-error messages. You could also say :
15 8 * * * /tmp/cronjob.sh >>/tmp/cronjob.log 2>>/tmp/cronjob.log
"...How can I quit my script while the nohup job is actually running?..."
--> Don't know if i understood this question, the "/tmp/cronjob.sh" script exit's automatically after executing the last line. Would in this case be after:
nohup /tmp/jobs/startjob &
and leaves the nohup job running.
--> This prevents any outputmail to be send to the cronjob owner? This is not required.
"...And what does this &1 mean?..."
--> This means all errors are redirected to the same file as non-error messages. You could also say :
15 8 * * * /tmp/cronjob.sh >>/tmp/cronjob.log 2>>/tmp/cronjob.log
"...How can I quit my script while the nohup job is actually running?..."
--> Don't know if i understood this question, the "/tmp/cronjob.sh" script exit's automatically after executing the last line. Would in this case be after:
nohup /tmp/jobs/startjob &
and leaves the nohup job running.
ASKER
thanks
15 8 * * * /tmp/cronjob.sh >>/tmp/cronjob.log 2>&1