Jump to content

Recommended Posts

Posted

All,

 

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.

 

Paul

Posted

just try

/home/your-tch-cpanel-name/path-to-file/file.name

 

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

/home/your-tch-cpanel-name/public_html/folder-name/file.name

Posted
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

/home/your-tch-cpanel-name/path-to-file/file.name

 

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

/home/your-tch-cpanel-name/public_html/folder-name/file.name

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:

>#!/usr/bin/php

  • 3 months later...
Posted

Just want to add that

 

wget -q -t 2 --delete-after http://mysite.net/script.php

 

does not appear to work (at least on my server). You get a

 

/bin/sh: line 1: /usr/bin/wget: Permission denied

 

Same thing with using Lynx the text-based browser (this used to work):

 

/bin/sh: line 1: /usr/bin/lynx: Permission denied

Join the conversation

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

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...