1
votes

Even though I set the PATH in /etc/crontab as

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/lib/mailman/cron:/usr/lib/mailman/bin

commands found in /usr/lib/mailman/cron are still not found, Thus issuing a mail to root saying

/bin/sh: mailman: command not found

I've debugged the problem, setting up a cron entry

* * * * * /bin/echo "`/bin/date`: $PATH" >> /tmp/crontest.log 2>&1

using crontab -e which actually do write the PATH to /tmp/crontest.log, confirming that the path entered in /etc/crontab is not what cron think it should be.

Fri Feb 14 10:22:01 CET 2014: /usr/bin:/bin

I've also tried to solve it by re-start cron using (both) service crond restart and service crond stop;sleep 5;service crond start (which does the same, but to make absolutely certain that it has been restarted), but this doesn't change anything.

The /etc/crontab file is readable by everyone (permissions is 644 root root)

-rw-r--r-- 1 root root 500 10 feb 10:36 /etc/crontab

/var/log/cron does not show anything about the problem, just what's started and when I restarted the cron

grep -v CMD /var/log/cron
.
.
.
Feb 14 09:45:34 p1kitlst01l crond[12214]: (CRON) INFO (running with inotify support)
Feb 14 09:45:34 p1kitlst01l crond[12214]: (CRON) INFO (@reboot jobs will be run at computer's startup.)
Feb 14 09:48:07 p1kitlst01l crontab[12331]: (root) BEGIN EDIT (root)
Feb 14 09:48:45 p1kitlst01l crontab[12331]: (root) REPLACE (root)
Feb 14 09:48:45 p1kitlst01l crontab[12331]: (root) END EDIT (root)
Feb 14 09:49:01 p1kitlst01l crond[12214]: (root) RELOAD (/var/spool/cron/root)
Feb 14 10:01:01 p1kitlst01l run-parts(/etc/cron.hourly)[13010]: starting 0anacron
Feb 14 10:01:01 p1kitlst01l run-parts(/etc/cron.hourly)[13027]: finished 0anacron
Feb 14 10:01:01 p1kitlst01l run-parts(/etc/cron.hourly)[13010]: starting mcelog.cron
Feb 14 10:01:01 p1kitlst01l run-parts(/etc/cron.hourly)[13039]: finished mcelog.cron
Feb 14 10:19:16 p1kitlst01l crontab[13840]: (root) BEGIN EDIT (root)
Feb 14 10:19:23 p1kitlst01l crontab[13840]: (root) END EDIT (root)
Feb 14 10:27:17 p1kitlst01l crond[14170]: (CRON) STARTUP (1.4.4)
Feb 14 10:27:17 p1kitlst01l crond[14170]: (CRON) INFO (running with inotify support)
Feb 14 10:27:17 p1kitlst01l crond[14170]: (CRON) INFO (@reboot jobs will be run at computer's startup.)

Any suggestions to what I have to look in to?

Henrik

1

1 Answers

0
votes

What I think is ,you have two ways to go (maybe others provide more).

1) set the absolute path for mailman in your script.

2) source the .profile, then run the script, such as:

0 1 * * * . ~/.profile; bash your_script.sh