Yes, this should run fine, assuming when you say "it runs fine on the command line" you're literally pasting the same command from the crontab entry. Things to check:
- Is the cron daemon actually running? (Run
- If it is running, try restarting it. (Depends on your flavour of Unix, but something like
service cron restart or
- If your script still doesn't run, check everything in
/var/log for appropriate output - the specific file depends on your syslog configuration, but
/var/log/syslog are good options if
/var/log/cron doesn't exist.
Note: You'll need to be
root to do most of these things - if you don't have access then you'll need to speak to the person who administers the machine.
Also, when you say you open a file in
/tmp, that's probably the most reliable thing you can do to ensure it's running. Right at the start of your script (before imports or anything) add this:
with open("/tmp/testfile", "a") as fd:
fd.write("I am running\n")
You can also check if your crontab is being correctly installed - it should be placed in something like
/var/spool/cron/crontabs (that's on Ubuntu Linux, it may differ on different Unix flavours). You should see a file in there with your username which should contain your entry.
Finally, if you get really desperate you could
strace your cron process to see what it's doing:
sudo strace -f -p `pidof cron`
You don't need to worry too much about the specifics, but it should be doing something every minute. If it's not then something's going quite wrong.