Question

I want to execute a script every 30mins, but i want to use it through cron as it is my personal script which emails me updates from various sites depending on configurations.

So what should i write in Command to run in cpanel to execute my script with name check.php

Was it helpful?

Solution

The format is something like this. Eactly the same as if you were trying to run the command from the terminal.

    php_location full_script_location output_location

So for example on my server I would use something like this:

/usr/bin/php /home/yacoby/status/check.php

You need to make sure your email address is set correctly.

If you don't want it to email you the output from the script (i.e. you want to log it, or do the emailing from within the script), put > /dev/null at the end of the command. eg.

/usr/bin/php /home/yacoby/status/check.php > /dev/null

OTHER TIPS

You could also try:

wget http://www.example.com/check.php

as then your script will run in exactly the same way it would on the website (environment variables, file permissions etc will be the same).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top