What can i Enter in a Cron Job Command?

Follow

Below are some Example Cron Job Commands

PHP

Command to run a PHP 5.5 cron job:

' /opt/php55/bin/php /home/username/public_html/cron.php '

Command to run a PHP 5.4 cron job:

' /opt/php54/bin/php /home/username/public_html/cron.php '

Command to run a PHP 5.3 cron job:

' /opt/php53/bin/php /home/username/public_html/cron.php '

Command to run a PHP 5.2 cron job:

' /opt/php52/bin/php /home/username/public_html/cron.php '

Optional flags are sometimes required for a PHP cron job:

' php -q /home/username/public_html/cron.php '

Command to use a specific php.ini file:

' php -c /home/username/public_html/php.ini /home/username/public_html/myscript.php '

Command to GET a remote file:

' /usr/bin/GET http://www.example.com/file.php '

Perl

Command to run a CGI cron job:

' perl /home/username/public_html/cgi-bin/file.pl '


SSH

Command to run a code script cron job:

' /bin/sh /home/username/public_html/file.sh '


MySQL

Command to import a database:

' mysql -u mysql_user -ppassword database_name < backup.sql '

Command to export a database:

' mysqldump -u mysql_user -ppassword database_name > backup.sql '

It is a good practice to use the -p flag. The System will Prompt for your password. This way your password stays secure and never exists on the server as plain text.

Have more questions? Submit a request

Comments

Powered by Zendesk