My cron job is not working
I am using cpanel, here I have set up cron
wget -O /dev/null http://www.mysite.com/cron.php?para1=value¶2=value2
This is not a job, but only once did I receive an email.
Resolving mysite.com... *ip address*
Connecting to mysite.com|*ip address*|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 164 [text/html]
Saving to: `/dev/null'
0K 100% 7.11M=0s
please tell me about it.
+3
source to share
1 answer
If you are using the latest version of cPanel, you will execute your cronjobs through jailshell (unless your cPanel account supports Normal bash). Because of this, you need to:
- Use absolute paths to your commands.
- Use curl as wget is not included in jailshell.
Below is a modified command using absolute paths and using curl instead of wget:
/usr/bin/curl http://www.mysite.com/cron.php?para1=value¶2=value2 >/dev/null 2>&1
You can remove "> / dev / null 2> & 1" to enable the output of the command and the source of any url that is being checked to be sent to you by email.
0
source to share