Shishant
Shishant

Reputation: 9294

cronjobs, how to use it in cpanel

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

Upvotes: 2

Views: 2425

Answers (2)

Richy B.
Richy B.

Reputation: 1617

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).

Upvotes: 4

Yacoby
Yacoby

Reputation: 55435

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

Upvotes: 1

Related Questions