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

I have a linux server where I want to install a Cron.

I was given a URL, and by visiting this URL (GET request), it will automatically rebuild a new sitemap for my website.

Basically, I want a cron to go to this URL once a day, thus my sitemap will be regenerated once a day

I'm not sure what info I need to give you regarding cron on my server...but when I go to /etc/ I can see... cron.d , cron.daily , cron.deny , cron.hourly , cron.monthy , crontab

one other thing, when i visit the GET request url myself, it takes a while before the page loads. It takes about 1-2 minutes and then a "SITEMAP COMPLETE" page appears. So the cron will have to stay at it for the entire duration until that message appears, else the sitemap will only partially regenerate.

Edit * I think I found the answer, can someone please confirm of this is correct ??? In crontab -e, I enter:

0 0 1 * * /usr/bin/wget -q -O - "http://www.domain.com/GET-REQUEST"

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

You can use 'wget' or 'curl', so yes your example is correct. You can ether add it with crontab -e or add the line to /etc/crontab (But add which user to run as)

share|improve this answer
    
If i use the wget, will it save a file on my server somewhere everytime the cron is run? –  Greatestswordsman Jun 11 '11 at 22:51
    
@Virendar Yes, if you use CURL it won't (Unless you specify the -O flag, but don't do that). Just set the command as curl http://yourdomain/script.php and that will download the file but not save it –  sam Jun 11 '11 at 22:53
    
@Virendar you could use wget with --spider as argument and that will make don't save the output –  Gabriel Sosa Jun 11 '11 at 22:57
    
hmm, so wget -q -O should be changed to either wget --spider or curl ? –  Greatestswordsman Jun 11 '11 at 23:19
    
@Verendar Ether use wget --spider http://yourdomain/script.php or curl http://yourdomain/script.php, not both =) I prefer CURL, purely because the syntax is easier, there's probably a performance comparison somewhere but it's more down to personal choice, which one you find easier to use. –  sam Jun 11 '11 at 23:25
show 1 more comment

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.