Crontab Help

Has anyone noticed or know of an issue with crontab in FreeBSD 7.2 not running shell or perl scripts? The scripts run fine manually, but they are not being ran by crontab. I noticed that /usr/local/etc/rc.d/backup.sh also hadn't been running on one of my servers since I updated the OS to 7.2. I checked some threads on forums, but didn't find a subject related to this issue.
 
Scripts do run from crontab, but cron has a limited path, so if you don't use either full paths to every command in your scripts or tell cron to use an extended path, a lot of applications cannot be found. I normally use this at the top of a crontab:

Code:
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
 
Using full paths is probably the safest thing to do. It also helps when you don't have root access to modify /etc/crontab to add the extra paths.
 
You really shouldn't be editing /etc/crontab. That's the system-wide crontab, used for automatically running OS services and things like periodic(8).

You should be using # crontab -e to edit the user-specific crontab, for whichever user the script should be running as.
 
Back
Top