What Do I Put for the Cron Job Command ?

Linux Web Hosting

Linux web hosting includes the following: Shared, Reseller, VPS and Dedicated. The commands below are compatible with Shared Reseller, SEO hosting and VPS and Deddicated Servers with Easy Apache 3 installed; these commands will not work on Windows Hosting or VPS with Plesk.

Command line examples only! Bold sections must be changed.

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 PHP5 cron job:

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 run a PHP4 cron job:

/usr/local/php4/bin/php /home/strong>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 is way your password stays secure and is never 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

Custom Installations without Easy Apache 3 (VPS/Dedicated)

PHP

Command to run for a PHP5 cron job:

/usr/local/php5/bin/php5 /home/username/public_html/cron.php

 

Command to run for a PHP4 cron job:

/usr/bin/php /home/username/public_html/cron.php

 

 
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What is a subdomain name? How do I create and delete one?

What is a subdomain name? How do I create and delete one? It is not always necessary to...

I created an Addon Domain, why did it say Subdomain added?

Help! I added an addon domain, but cPanel said a subdomain has been created. Please ignore this!...

How to Connect to the MySQL Database

How to Connect to the MySQL Database Connect via Script Connect Remotely In...

How to change DNS zones (MX, CNAME, and A records)

With cPanel 11.25, you now have access to make some of these changes. Note: This effect...

htaccess long lines

Sometimes when you edit the .htaccess file in cPanel, the lines must wrap and this causes a line...