Linux – How to do a Cronjob via SSH on Linux

cronlinuxssh

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"

Best Answer

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)