Crontab entries don't work

Hello everyone,
I need to have a python script running every minute to send a heartbeat broadcast.
I have developed this sript and it works just fine when I start it from the shell.
Next step was to actually add it to the cron list.
So I have been looking on the net and I saw that should be possible by using crontab -e.
So that’s what I’ve done, resulting in the following :

`
30 * * * * /usr/bin/ntpdate-sync silent
1 * * * * python /home/root/keep_alive.py >>cronjob.log

`

at some point I even added :

`
SHELL=/bin/sh

`

and also :

`
@reboot python /home/root/keep_alive.py >> cronjob.log

`

and because I saw it on the net as well I even tried specifying the user :

`
@reboot root /home/root/keep_alive.py >> cronjob.log

`

Unfortunately none seem to work at all, as in there are no broadcasts nor any entry to the log file !
I was wondering if anyone can help me out here.

Greetings,

Hello everyone,
I need to have a python script running every minute to send a heartbeat
broadcast.
I have developed this sript and it works just fine when I start it from the
shell.
Next step was to actually add it to the cron list.
So I have been looking on the net and I saw that should be possible by
using crontab -e.
So that's what I've done, resulting in the following :

30 * * * * /usr/bin/ntpdate-sync silent
1 * * * * python /home/root/keep_alive.py >>cronjob.log

    The first line in your crontab runs once per hour at 30 minutes past the top of the hour. The second line also runs once per hour, but runs 1 minute past the top of the hour. *NOT* once every minute as you desired.

    Crond runs *only* once every minute (finest resolution possible), so if you want a cron job to run once every minute, then you need to set the fields as follows:

    * * * * * /home/root/keep_alive.py >> cronjob.log

    And check to make certain that your script actually resides in the directory path you have given (/home/root/). The 'root' account's home directory is /root, not /home/root, so to have /home/root you must have performed a mkdir to create that root subdirectory under /home. Also be aware that plain old users CANNOT run scripts that require 'root' permissions. They must be run out of the system crontab configured in /etc/crontab.

    Also verify that the permissions are set correctly on your python script so that it is executable. 'ls -al keep_alive.py' will show the permissions. 'chmod u+x keep_alive.py' will turn on the execute bit for this file to be run as the User.

    Hope this helps!

       --- Jay Nugent WB8TKL
           UNIX/Linux System Administration instructor
           Washtenaw Community College - Ann Arbor, Michigan

See below....

Hello everyone,
I need to have a python script running every minute to send a heartbeat
broadcast.
I have developed this sript and it works just fine when I start it from the
shell.
Next step was to actually add it to the cron list.
So I have been looking on the net and I saw that should be possible by using
crontab -e.
So that's what I've done, resulting in the following :

30 * * * * /usr/bin/ntpdate-sync silent
1 * * * * python /home/root/keep_alive.py >>cronjob.log

It is always a good idea to add an absolute path, and if u consider
Jay's tips, the correct for every minute is:
* * * * * /pathtopython/python /home/root/keep_alive.py >>
/home/root/cronjob.log
or if keep_alive.py is an executable simply
* * * * * cd /home/root/; keep_alive.py >> cronjob.log
or ....

at some point I even added :
SHELL=/bin/sh

Why not SHELL=/bin/bash

and also :

@reboot python /home/root/keep_alive.py >> cronjob.log

try
@reboot /home/root/keep_alive.py >> /home/root/cronjob.log

and because I saw it on the net as well I even tried specifying the user :

@reboot root /home/root/keep_alive.py >> cronjob.log

@reboot root /home/root/keep_alive.py >> /home/root/cronjob.log
is the correct entry in /etc/crontab (and not the users crontab)

HTH....