Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Dec 27, 2012 4:23 pm 
Offline
Newbie

Joined: Thu Dec 27, 2012 4:17 pm
Posts: 3
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:

Code:
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:

Code:
warren@plato:~$ mail
No mail for warren


Am I missing something obvious? Thanks!


Top
   
PostPosted: Thu Dec 27, 2012 5:16 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
Did you restart cron after editing the job,
Code:
service cron restart
or
Code:
service crond restart
should do it depending on your distro

_________________
Paid support
How to ask for help
1. Give details of your problem
2. Post any errors
3. Post relevant logs.
4. Don't hide details i.e. your domain, it just makes things harder
5. Be polite or you'll be eaten by a grue


Top
   
PostPosted: Thu Dec 27, 2012 9:28 pm 
Offline
Senior Member

Joined: Sun Aug 31, 2008 4:29 pm
Posts: 177
You may need to provide the full path to python for cron, e.g.:

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

_________________
sleddog


Top
   
PostPosted: Thu Dec 27, 2012 9:44 pm 
Offline
Newbie

Joined: Thu Dec 27, 2012 4:17 pm
Posts: 3
Thanks, I'll try both suggestions and see if that fixes it!


Top
   
PostPosted: Fri Dec 28, 2012 4:56 pm 
Offline
Newbie

Joined: Thu Dec 27, 2012 4:17 pm
Posts: 3
Looks like that did the trick! Issue resolved.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group