Crontab Question

Questions and Answers : Unix/Linux : Crontab Question
Message board moderation

To post messages, you must log in.

AuthorMessage
Profile Joe Giampaoli

Send message
Joined: 14 Sep 99
Posts: 2
Credit: 4,505
RAC: 0
Mexico
Message 6842 - Posted: 12 Jul 2004, 7:49:09 UTC
Last modified: 12 Jul 2004, 7:51:29 UTC

I created a crontab for boinc to run up at start up
such as:
* * * * * cd/boinc_dir; ./boinc_app
and it runs perfectly fine, butI have a question, is the
> /dev/null 2> /dev/null
necessary?, and what is it for?
Sorry if this question sounds dumb but I've been running LINUX for 2 weeks now. Still a newbie.
Thanks.
Joe Giampaoli
ID: 6842 · Report as offensive
TrevMeister

Send message
Joined: 14 May 99
Posts: 3
Credit: 356,620
RAC: 0
United States
Message 6860 - Posted: 12 Jul 2004, 9:24:19 UTC

The first part, "> /dev/null", diverts "standard output" (a program's normal output) to the bit bucket (throws it out). The second part, "2> /dev/null", redirects "standard error" (a program's error messages) to the same.

Without these options, every line of output generated by Boinc--and there is a quite a bit of output--would trigger an e-mail to root.

If you wanted to be notified of errors, you could eliminate the "2> /dev/null" directive.
ID: 6860 · Report as offensive
Profile Joe Giampaoli

Send message
Joined: 14 Sep 99
Posts: 2
Credit: 4,505
RAC: 0
Mexico
Message 7236 - Posted: 13 Jul 2004, 2:29:21 UTC - in response to Message 6860.  

Ok, thanks a lot for your help.
Just to make sure the crontab line would be something like this?:

* * * * * cd/my_boinc_dir; ./my_boinc_app > /dev/null 2> /dev/null

Just want to make sure I'm not missing anything like a space or something else.

Thanks again for your help.
Joe Giampaoli
ID: 7236 · Report as offensive
Profile Tony Salcedo

Send message
Joined: 3 Apr 99
Posts: 2
Credit: 648,503
RAC: 0
United States
Message 7519 - Posted: 14 Jul 2004, 3:31:06 UTC - in response to Message 7236.  

If I understand the crontab format correctly, the line below will try
to run 'my_boinc_app' once a minute, every minute, all day long!!

> Ok, thanks a lot for your help.
> Just to make sure the crontab line would be something like this?:
>
> * * * * * cd/my_boinc_dir; ./my_boinc_app > /dev/null 2> /dev/null

This line is a little better behaved:

0,15,30,45 * * * * cd /my_boinc_dir/; if ps -aux | grep -v grep | grep "boinc"; then exit; else ./my_boinc_app > /dev/null 2> /dev/null; fi

It will check every 15 minutes to see if there is an active process with the string 'boinc' in it's name. If there is none, it will start 'my_boinc_app".

(you may be able to simplify the begining part from '0,15,30,45' to '*/15')
ID: 7519 · Report as offensive

Questions and Answers : Unix/Linux : Crontab Question


 
©2024 University of California
 
SETI@home and Astropulse are funded by grants from the National Science Foundation, NASA, and donations from SETI@home volunteers. AstroPulse is funded in part by the NSF through grant AST-0307956.