Setting up a Cron job

What do you input into ‘command to run’ textarea? I have the php script I’d like to run in a php file. Do I have to ‘link’ to the php file or type the script into the textarea?

Any help would be great!

to have cron run a script for you that text should look something like:

/usr/local/bin/php /home/user/path/to/script/script.php

Note that there’s a space between the two paths there. Update the 2nd path to point to where your php script is. “user” would be replaced with the user name you log into with FTP to upload the script, and then the directory structure of where it’s stored.

–Matttail - personal website

Hi, just out of interest, does it matter if the command ‘wraps’ after usr/bin/php. I can’t get it to stay in one line. Using crontab it seems to have to be all on one line.


yes, it matters. If it’s broken onto two lines cron will interpert it as two lines. Are you setting up this script from the panel or through SSH? (if crontab from SSH shows it as one line, then you’re good)

–Matttail - personal website

Whoops, missed your reply. I’m entering it in the CP. It was ok in the Putty edtor.

Incidentally it breaks where the two spaces in the string are located.

/usr/bin/php /home/.lemnos

to achieve this i use in the crontab a command like :

Then I put this on the first line myphpscript.php file, in text mode and befor the <? php open tag

#! /usr/local/bin/php -q

That seems to be a glitch with the panel. Perhaps temporary, as no one’s posted about this before to my knowledge. You can use the above solution to above to avoid a space in the cron job, or set up your cron job from putty. Once you log in type “crontab -e” put in your command and put in a blank line (carriage return) at the end. Press ctrl-o and then ctrl-x. You should get a success message back.

–Matttail - personal website

Thanks for the info.

Not forget to use /usr/local/php5/bin/php if you use Php 5

Best Regards

Admin Sanremo IN