crontab script execution - different behaviour user-cronfile <-> system-wide cronfile
Hello everybody.
I stumbled upon the following: Script iptables_reset.sh Code:
#!/bin/bash Code:
0 12 * * * root /root/iptables/iptables_reset.sh Code:
crontab -l Code:
/USR/SBIN/CRON[5135]: (root) CMD (/root/iptables/iptables_reset.sh) What i can't figure out is why. Maybe someone can enlighten me?! |
maybe the user cron doesn't have a correct PATH.
if so, you just have to define PATH somewhere (the script or the crontab). |
Non-root user wouldn't have that in their path...
|
the user is root ;).
|
Really, the main point is that the default env settings for cron are minimal; this sort of issue, even for quite innocuous cmds/files is common.
The general rule is (search LQ) to always use full paths to all cmds/files required if running under cron. Other options include sourcing the relevant user's .bash_profile/.bashrc files or set the cron env vars: http://adminschoice.com/crontab-quic...Crontab%20file |
All times are GMT -5. The time now is 08:23 PM. |