Crontab - stop sending mail, special case ||

Posted by 2ge on Server Fault See other posts from Server Fault or by 2ge
Published on 2011-01-03T03:54:44Z Indexed on 2011/01/03 4:55 UTC
Read the original article Hit count: 236

Filed under:
|
|

Hi all,

I need to put into my crontab small command, which is checking, if lighttpd web server is running, for some reason it hangups sometimes. So I got there:

*      *       *       *       *       root    /bin/pgrep lighttpd || /usr/local/etc/rc.d/lighttpd restart >/dev/null 2>&1

problem is, this send me mail every minute, in the mail is number of PID of lighttpd, which is running. For other crontab job, redirection work, so I assume, when is there "||", it makes problem.

maybe there should be better to rewrite crontab job, so it uses exit status of pgrep, so I can avoid "||". I am using FreeBSD.

Thanks for any help, for now I disabled this job

© Server Fault or respective owner

Related posts about cron

Related posts about mail