This article will provide examples of different commands you can use in Cron Job. If you need a different explanation on Cron Jobs, please refer to this list of Cron Job articles:
Command lines. Examples only! Bold sections must be changed.
Note: You may need to adjust /home/ to /home#/ depending on the home directory your account resides on. 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.
Command to run a PHP7 cron job:
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:
Command to run a CGI cron job:
Command to run a shell script cron job:
Note: It is 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
Recommended Help Content
Script executed with a cron job requires a specific php.ini file to be used.
How to run cron jobs at a specific "local" date and time.
tags: cron time
This article will explain how to setup, remove, or edit a Cron Job.
Related Help Content
Learn how the Cron Job tool can help you automate the scripts on your web site.
This article will explain how to add a PHP handler to your .htaccess files. This is useful if you want to customize the version of PHP that runs your PHP files.
This article will explain how to create MIME types.
The php.ini file can be viewed from a web browser.
This article will explain how to utilize GZip through the file manager.
How do I increase my file size limit in my PHP application?
This article will outline which PHP PEAR Packages are installed and how you can install additional PHP PEAR Packages.
This article explains how to enable FastCGI for PHP applications.
tags: fastcgi php