Solved

Nohup problem in crontab

Posted on 2001-08-16
6
3,926 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 5

Accepted Solution

by:
paulqna earned 20 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
Industry Leaders: 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
viewing source code from eclipse 13 111
how to split multiple lines delimiter : 8 133
Way to decrease size of apk file 9 132
listing all the respondents to a twitter feed - Java 5 47
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

739 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