cron job not running on Linode VPS?

Hi,

I signed up for a Linode 512 recently. I've been running a Django app on it, and so far so good. But I can't seem to get cron to run a Python script I set up.

I followed the instructions at http://library.linode.com/linux-tools/utilities/cron and it seems to be set up appropriately:

warren@plato:~$ crontab -l
0 0 * * * python /home/warren/code/habitbot/manage.py geninstances
warren@plato:~$ ps -el | grep cron
5 S     0  1631     1  0  80   0 -  1099 ?      ?        00:00:00 cron

I added that command by doing crontab -e. I expected it to run the script every day at midnight. Also using @daily and @hourly instead of 0 0 * * * seemed to have no effect.

The script runs fine when I run the command string by hand as the user "warren".

But the database records the script should create don't seem to be getting created. The script prints stuff to stderr, so if cron is logging the output, where would I go to find it? Cron said it would send mail to my account, but I don't have any mail:

warren@plato:~$ mail
No mail for warren

Am I missing something obvious? Thanks!

4 Replies

Did you restart cron after editing the job, service cron restart or service crond restart should do it depending on your distro

You may need to provide the full path to python for cron, e.g.:

0 0 * * * /usr/bin/python /home/warren/code/habitbot/manage.py geninstances

Thanks, I'll try both suggestions and see if that fixes it!

Looks like that did the trick! Issue resolved.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct