Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Nohup problem in crontab

Posted on 2001-08-16
6
Medium Priority
?
4,399 Views
Last Modified: 2013-12-26
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
0
Comment
Question by:hln_01
  • 3
  • 3
6 Comments
 
LVL 5

Accepted Solution

by:
paulqna earned 80 total points
ID: 6392665
You need to create a script containing the nohup

Script example (/tmp/cronjob.sh):
nohup /tmp/jobs/startjob &

Crontab example:
15 8 * * * /tmp/cronjob.sh >>/tmp/cronjob.sh 2>&1
0
 
LVL 5

Expert Comment

by:paulqna
ID: 6392672
Crontab line shoul of course be :
15 8 * * * /tmp/cronjob.sh >>/tmp/cronjob.log 2>&1
0
 

Author Comment

by:hln_01
ID: 6395502
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?



0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:hln_01
ID: 6395670
How can I quit my script while the nohup job is actually running?  
0
 
LVL 5

Expert Comment

by:paulqna
ID: 6396555
"...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.
0
 

Author Comment

by:hln_01
ID: 6405338
thanks
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question