Crontab not working logwatch.pl [FreeBSD 8 stable]
listreader at lazlarlyricon.com
Wed Jan 13 21:13:31 UTC 2010
On 2010-01-13 22:04, Jeronimo Calvo wrote:
> did a crontab -r, a a new crontab -e, using:
> * * * * * $HOME/.profile ; /bin/bash /var/log/auto_auth.sh
> * * * * * $HOME/.profile ; /usr/bin/perl /local/sbin/logwatch.pl
> tailing the /var/log/cron I can see that is being executed every
> minute... but no emails arrived with is the proof that the script has
> 2010/1/13 Rolf Nielsen<listreader at lazlarlyricon.com>:
>> On 2010-01-13 21:43, Jeronimo Calvo wrote:
>>> Hi folks,
>>> Im having probs when a root crontab located on /var/cron/tabs/root
>>> with this content
>>> # DO NOT EDIT THIS FILE - edit the master and reinstall.
>>> # (/tmp/crontab.DUtgfVoBT0 installed on Wed Jan 13 20:08:29 2010)
>>> # (Cron version -- $FreeBSD: src/usr.sbin/cron/crontab/crontab.c,v
>>> 184.108.40.206 2009/08/03 08:13:06 kensmith Exp $)
>>> * * * * * ~/.profile ; /bin/bash /var/log/auto_auth.sh
>>> * * * * * ~/.profile ; /usr/bin/perl /local/sbin/logwatch.pl
>>> both of them are sending logs to my email, when runned from the
>>> command line works, but not from crontab
>>> any ideas?
>> The keywords here are
>> # DO NOT EDIT THIS FILE - edit the master and reinstall.
>> Either edit the system crontab, /etc/crontab, or, to edit root's crontab,
>> run crontab -e as root.
Please don't top post.
Firstly, don't rely on environment variables being set correctly when
running from cron. If you really want to use root's crontab, substitute
/root for $HOME.
Secondly, bash should be in /usr/local/bin, not in /bin. And it's a
third party shell not included by the system. It has to be installed
from ports. You should use /bin/sh instead.
Thirdly, instead of putting the interpreter path on the command line,
put it on the first line of your scripts, i.e.
#!/bin/sh in the first one
#!/usr/bin/perl in the second one.
More information about the freebsd-questions