WebFaction
Community site: login faq

When I use the following command in a shell:

/usr/local/bin/python2.7 /home/myuser/webapps/nginx/apps/myapp/manage.py remove_old

...the command does the job! It outputs "Removed X", which is what I expect. However, when I use it in a crontab, like this:

MAILTO=my@mail.com
@hourly /usr/local/bin/python2.7 /home/myuser/webapps/nginx/apps/myapp/manage.py remove_old

...it sends me an e-mail with the same output every hour, as if the actual deletion isn't taking place.

The Python code I've written does nothing special, so I don't understand why it works when done "manually" but not when executed in a cron job.

Any ideas?

asked 13 Sep '12, 11:25

damd
191712
accept rate: 0%

Try redirecting the output to a log to see if it captures any error messages. You can add: 2>&1 >> /home/myuser/cron.log to the end of your command for example.

(13 Sep '12, 16:33) bmeyer71 ♦♦

@bmeyer71: But doesn't the MAILTO directive do just that? Because as I said, I do get e-mails, but maybe that's only stdout?

(13 Sep '12, 17:04) damd

@damd: Yes it should send that information. However, you might still want to give the redirect a try to see if it provides anything different.

(13 Sep '12, 17:29) bmeyer71 ♦♦

I just tried that now, with the cron job running once every minute. It only outputs "Removing X" once and then stopped. Now what? :)

(14 Sep '12, 04:14) damd

Maybe open a support ticket for us to take a closer look.

(14 Sep '12, 07:22) bmeyer71 ♦♦

Thanks, I'll do that when it happens again. (It's really difficult to reproduce it "manually", so to speak.)

(14 Sep '12, 14:26) damd
showing 5 of 6 show 1 more comments
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×337
×81

question asked: 13 Sep '12, 11:25

question was seen: 3,945 times

last updated: 14 Sep '12, 14:26

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM