django-newsletter, cron job not working

191 views
Skip to first unread message

frocco

unread,
Apr 17, 2013, 2:38:53 PM4/17/13
to django...@googlegroups.com
Hello,

Can someone give me an example of running a cronjob hourly?
I am on webfaction and cannot get this working.

I tried

@hourly /usr/local/bin/python2.7 ~/webapps/ntw/myproject/manage.py runjob submit

I get no email

If I SSH in and sunit manually, it works fine

Shawn Milochik

unread,
Apr 17, 2013, 2:42:09 PM4/17/13
to django...@googlegroups.com
It's almost certainly an environment issue, such as an issue with your PATH or PYTHONPATH.

Just add to the command so that it puts all standard output and standard error to a file to read what the message is.

your_command &> /tmp/broken_cron.log

Then rig your cron job to run ASAP and read the log.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Sam Walters

unread,
Apr 17, 2013, 2:59:31 PM4/17/13
to django...@googlegroups.com
Hi
In addition to the previous advice i would also check /etc/init.d/cron to see if the daemon is running.

make sure you have the correct date+time settings in your shell eg: 'date' command.

also run some sort of primitive debug command like:
* * * * * touch "/tmp/$(date +\%d-\%m-\%Y-\%T)"
for a couple of minutes to see if it executes.

my money is on a path issue though ;)



frocco

unread,
Apr 17, 2013, 3:03:56 PM4/17/13
to django...@googlegroups.com
Thank you

Tom Evans

unread,
Apr 18, 2013, 6:16:47 AM4/18/13
to django...@googlegroups.com
Specify the full, absolute path to the file. Cron won't expand '~'.

Cheers

Tom

Shawn Milochik

unread,
Apr 18, 2013, 10:07:42 AM4/18/13
to django...@googlegroups.com
Here's an example of something taken straight from my crontab from a WebFaction account:

44 * * * * cd ~/webapps/awstats_milocast;./update_awstats.sh

This runs on minute 44 of every hour. There are five "time" parameters. The first one is "minute." If you set a number there, it'll run on that minute every hour.



Tom

Reply all
Reply to author
Forward
0 new messages