[X-Unix] Cron jobs not running, how to log cron

James Bucanek subscriber at gloaming.com
Thu Jun 17 06:56:50 PDT 2004


Jerry Krinock wrote on Thursday, June 17, 2004:

>on 04/06/16 18:48, David Haines at haines.d at comcast.net wrote:
>
>> Here's the listing (crontab -l) :
>> 
>> 45      1       *       *       *       root    /etc/ditto_daily.sh
>> 15      0       *       *       1,2,4,6 root    /etc/junkmailcleanup.sh
>
>It looks like you have a column in there for "user"="root".  I have never
>seen this syntax.  Try this instead:
>
>> 45      1       *       *       *         /etc/ditto_daily.sh
>> 15      0       *       *       1,2,4,6   /etc/junkmailcleanup.sh
>
>To make a cron job to run with user=root, you name its file "root"; i.e. put
>it in the file /var/cron/tabs/root.

There are two styles of crontabs.  The crontab in /etc/crontab is the first style (above) which is shared by all users.  The extra column indicates the user name the job is supposed to run under.

The global crontab was considered a maintenance problem and security risk, so it was later replaced by individual crontabs in /var/cron/tabs/<user>.  cron still supports both.  Since these crontab already belongs to an individual user, the column indicating the user is superfluous.

see 'man 5 crontab' for the details.

>Also, make sure you are using the crontab editor, not any old text editor.

There's no such thing as a "crontab editor" (at least in the core BSD UNIX system).  The 'crontab -e' command simply calculates the crontab file to use and launches the $EDITOR of your choice.  So for the actual editing, there is no difference between using 'crontab -e' and 'pico /etc/crontab'.

see man crontab

However, I personally enjoy using CronniX to edit crontabs in OS X.

Thinking about Jerry's problem, about the only thing I could come up with is to ask if the .sh files have a valid "she-bang" line?  You might be able to run them as scripts from a shell, but when run by themselves, the system needs to know the complete path to the interpreter in order to execute it.

______________________________________________________
James Bucanek       <mailto:privatereply at gloaming.com>



More information about the X-Unix mailing list