Jump to content

Recommended Posts



I've read the recent cron threads here, but I'm still not exactly sure what I need to do to set this up.


I've opened the Cron setup tool in CPANEL and selected the frequency I want the command to run, but I'm still confused as to what to put in for the command.


Basically I want it to run a php file like *****/maint/file.php


should the command be:


GET *****/maint/file.php > /dev/null


and is the > /dev/null needed?


Thanks for the guidance.



Link to post
Share on other sites
should the command be:

>GET *****/maint/file.php > /dev/null

and is the > /dev/null needed?

GET makes a web page request through the web server, just like a browser does, and whatever the web server sends back is returned to the command. In a cron job, any output by a command is interpreted to be an error and e-mailed to the user. The "> /dev/null" discards the output from the GET command, so cron won't be triggered into sending an e-mail when you don't want it to. (Yes, it is probably needed.)


Not too long ago, I tried using GET in a cron job on my account and it did not work. I had to use an alternate form of the GET command to get it working:

>lwp-request -m GET http://www.my-TCH-site.com/path/to/file.php > /dev/null


Instead of using GET, you might want to try the following in your cron job instead:

>php -q /home/cpanelName/path/to/file.php


just try



if the file is in a folder below the public_html folder, use


This will work if the file has a shebang line for the first line of the file. Without it, a cron job can't run the script file directly. A PHP script would need the following as the first line in order to be run directly in a cron job:


Link to post
Share on other sites
  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...