Cornjob Commands in cPanel
Written by Saran on March 18, 2012
Updated December 21, 2013
Cron jobs allow you to automate certain commands or scripts on your site. You can set a command or script to run at a specific time every day, week, etc. For example, you could set a cron job to delete temporary files every week to free up disk space.
Here are few useful commands for newbie cPanel users, this will help you run scripts at a specific time. Just choose a timing in cPanel "Add new Corn Job" settings and enter following commands in command inputbox, where XXXX is your scripts name, hope it helps.
- Run a PHP script at specific time : [cc lang="text"] php /home1/user8/public_html/XXXX.php [/cc]
- Set a timing to delete your apache error_log files. [cc lang="text"] rm /home1/user8/public_html/error_log [/cc]
- Delete all cache files inside cache directory. [cc lang="text"] rm /home1/user8/public_html/cache/* [/cc]
- Run a shell script. [cc lang="text"] /bin/sh /home1/user8/public_html/yourfile.sh [/cc]
- Execute a PHP file and save corn errors in a file [cc lang="text"] php /home1/user8/public_html/XXXX.php > /home1/user8/public_html/log_file [/cc]