What Do I Put for the Cron Job Command?

Linux Web Hosting

The commands below are compatible with Linux hosting plans only. These plans include Shared, Reseller, VPS, and Linux Dedicated Servers.

Note: These commands will not work on Windows Hosting or VPS packages with Plesk.

The commands provided below are examples of typical script locations. The bold sections within each command will need to be replaced with your cPanel username and your script name.

Note: You may need to adjust /home/ to /home#/ depending on the home directory on which your account resides. To view the home directory for your account simply view the stats column on the main cPanel page of your account, and look for the home directory.

 

PHP

Command to run a PHP 7.0 cron job:

/opt/php70/bin/php /home/username/public_html/cron.php


Command to run a PHP 5.6 cron job:

/opt/php56/bin/php /home/username/public_html/cron.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
Note: It is a good practice to not type your password out in the follow commands but to simply use the -p flag alone and have the system prompt you for the password. This way your password stays secure and never exists on the server as plain text.

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

  • 0 Users Found This Useful
Was this answer helpful?

Also Read

How to Set a Cron Job to Use a Specific php.ini File

Some scripts executed with a Cron Job require a specific php.ini file to be used. When...

Setting a Cron to Run at a Specific Date and Time

In order to correctly set joudiSoft's servers to perform a desired task in the form of a cron...

Using Network Tools in cPanel

One of the most useful tools in cPanel that is often overlooked is the Network Tools function....

Custom Error Pages

What are Custom Pages for Errors? When your website generates an error, such as a 404, it...

Error Pages Codes

What are Error Codes? All HTTP requests (the type of requests generated by your browser when...