Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I need that every night at 2:00 am a call to a specific URl is made.

For this reason, I inserted in the cronotab services the following:

crontab -e


0 2 * * * wget -q -0 - "http://MYWEBSITE"

But it seems not working..

Where am I wrong?

share|improve this question

4 Answers 4

There's an additional "-" that shouldn't be there, otherwise it looks good to me.

0 2 * * * wget -q -0 "http://MYWEBSITE"

Do you have any mail in your personal /var/mail directory about this task? You should be notified by this when logging in, "You have new mail". Crontab will send you an email with the output of wget every time the task runs. This should tell you about errors, and successfull runs.

Edit: I don't see the "-0" parameter anywhere in the docs, what is it supposed to do?

share|improve this answer

Try to run it manually without -0 option with wget and also remove the extra - in the cmd. It it runs okay, make the changes in crontab accordingly. Also check the crontab logs for job history.

share|improve this answer

You might find that you're missing a newline at the end of your crontab - that will make the last entry be ignored.

Otherwise you'll need to see what is failng:

  • Is the cronjob not running.
  • Is wget failing.

You can test the former by adding a new job like so:

*/2 8 * * * touch /tmp/test

Wait two minutes and see if it works. If it does then it means that your wget call is failing. Could you be missing the PATH? Update it to read /usr/bin/wget instead?

share|improve this answer
up vote 0 down vote accepted

Do not ask me why the "-0" or the single "-", I do not have idea what they are useful for, but they were suggested to me in another place

However, I found this working:

0 2 * * * wget -O - -q -t 1 "http://mysite"

Anyway +1 each for your suggestions, thanks

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.