Stack Exchange Network
Stack Exchange network consists of 181 Q&A communities including
Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.
Sign up to join this community
Anybody can ask a question
The best answers are voted up and rise to the top
11 years, 7 months ago
I need to set up a cron job in cpanel that calls a URL (on the same server) once a week. I was going to use
wget but it turns out this is disabled on the shared server being used.
Is there an alternative to
wget? I've heard that curl can be used but I don't know how to set that up in a cron command.
Also, what's the command to make the cronjob do nothing on completion?
Any ideas greatly appreciated!
39k 10 10 gold badges 103 103 silver badges 189 189 bronze badges
Aug 9, 2011 at 16:15
335 1 1 gold badge 2 2 silver badges 4 4 bronze badges
instead of using wget, curl works like this:
curl --silent http://domain.com/cron.php
which will work in the same way as wget. if its a php file you are launching, is there any reason you cant run it via the command line php interpreter like so:
php -q /path/to/cron.php
same on a webserver request and often will work much faster and without certain timeout restrictions present when called via webserver/curl
Aug 9, 2011 at 16:29
4,243 2 2 gold badges 21 21 silver badges 24 24 bronze badges
If curl is available you could try something like
1 1 * * 0 /usr/bin/curl --silent http://example.come/some.php &>/dev/null
That should cause curl to be completely silent so you don't get any email from it on completion.
I'd suggest to add "-m" parameter in addition to --silent as this parameter sets the maximum time allowed for the transfer. Imagine you call the cron every minute and the script takes 2mins - this can have bad impact on the server load or other things.
1 1 * * 0 /usr/bin/curl -m 120 -s http://example.come/some.php &>/dev/null
Oct 27, 2015 at 15:07
By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our
Accept all cookies
Necessary cookies only