WebFaction
Community site: login faq

I set up a crontab task to run hourly. This is a task the executes a wget command to work around the MySQL server has gone away error. However, the task seems to only have been running between 3 and 10 AM. What gives? Here is my crontab entry:

0 * * wget http://some.site.com/Blah

wget writes a Blah file (then Blah.1, Blah.2 etc. but only till 10:00 AM. Then it appears the task is not executing. (The real URL has been changed to protect secret projects. ;) )

asked 27 Sep '11, 20:09

devnull255
112
accept rate: 0%


I looked up your account and visited the real URL with wget locally and in a browser locally, it provides a 500 error, is that normal?

[EDIT]

What I mean, is there something special that makes this only work on that machine, or some other reason it would be having a 500 when I visit it, or could it be the source of the issue.

permanent link

answered 27 Sep '11, 20:36

johns
5.4k312
accept rate: 23%

edited 27 Sep '11, 20:37

That would be the MySQL 'server has gone away issue'. (I followed the advice of changing the sqlalchemy.pool.recycle parameter to 3600, but this still does not make that issue go away). I am using pylons so if I restart it using paster, you won't get that. When cron runs that task every hour, I don't have that problem. I believe I followed the suggestion of setting up an hourly wget task in this forum. But it doesn't help if cron doesn't run this hourly task 24-7 like my crontab entry says it should.

(28 Sep '11, 15:18) devnull255

Try using @hourly <command> or specify 0 * * * * <command> for your crontab entries.

I believe all 5 date/time fields are required.

(28 Sep '11, 15:38) bmeyer71 ♦♦

I have the second way you specified. I think some of the asterisks were misinterpreted as some kind of simple html symbols when I entered them in my question here. 0 plus 4 asterisks then the command. Again, what I used should have been interpreted as every hour and not 3-10.

(28 Sep '11, 19:45) devnull255

At this point its difficult to tell, your syntax should have worked but if the web server was not running as expected than the wget command would not have downloaded anything but shown an error. You should add logging to the cron itself by adding '> $HOME/cron.log 2>&1' to the end as outlined here,

http://docs.webfaction.com/software/general.html#scheduling-tasks-with-cron

That should send all of the verbose info from wget to that file and you can determine what its doing when.

(28 Sep '11, 20:58) johns

Thanks for that last suggestion about the cron log file. I changed the frequency of the job from hourly to quarter-hourly and it's been running fine since. I imagine that hourly was just not enough to prevent the 'server has gone away error' so it probably ran fine for the first 7 hours, but somehow on the 8th hourly run there was probably an error so the wget no longer created a file. I'm sure at some point the cron log would have showed the 500 server error if I had kept it an hourly task, but since it seems to be running continuously with the new frequency I am reluctant to change it back (at least right now).

(29 Sep '11, 06:40) devnull255
Your answer
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:

×81
×50
×7

question asked: 27 Sep '11, 20:09

question was seen: 4,224 times

last updated: 29 Sep '11, 06:40

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