Cron Job Problem
Hi All,
I am facing the problem, i am putting what i have done: This is my script( create_zip.php) ##### create zip file code start here ###### #!/usr/local/php5 <?php $sdate = date("d_m_Y_H_i_s"); $back_path='/home/sites/htdocs/chetan/backuptest/'; $target_path='/home/sites/htdocs/chetan'; $db_script_name = $back_path."testnewdb_".$sdate.".sql"; $code_sugar = $back_path."sugarCRM_".$sdate.".tar.gz"; /*shell_exec("mysqldump -h<myhostname> -usharma -psharma testnewdb > $db_script_name"); shell_exec("tar -czf $db_script_name.tar.gz $db_script_name"); shell_exec("rm -rf $db_script_name"); shell_exec("tar -czf $code_sugar $target_path/sugarCRM/");*/ shell_exec("mysqldump -h<myhostname> -usharma -psharma testnewdb > $db_script_name"); shell_exec("zip -r $db_script_name.tar.gz $db_script_name"); shell_exec("rm -rf $db_script_name"); shell_exec("zip -r $code_sugar $target_path/sugarCRM"); ?> ##### create zip file code end here ###### and my crontab file is having the following details # m h dom mon dow command 0,01,02,03 * * * * /home/sites/htdocs/chetan/backuptest/create_zip.php >> /dev/null 2>&1 Now please tell me where i am wrong how can i check my cron job is running or not because it's putting me back. Regards, Chetan |
Quote:
Does the script work when you execute it? look in /home/sites/htdocs/chetan/backuptest/ if the files are made? |
First check the system logs, for example /var/log/cron or /var/log/messages and check for entries like
Code:
Jan 11 07:30:01 linux crond[14672]: (username) CMD (/home/sites/htdocs/chetan/backuptest/create_zip.php >> /dev/null 2>&1) Regarding this specific issue, I found an interesting article here. Hope this helps. |
Quote:
|
Cron Job
yes my script is running when i run my script using the command prompt
i am using this command to run the script from command prompt php create_zip.php the above command create two tar.gz files in the /home/sites/htdocs/chetan/backuptest Quote:
|
for every 1 minute, its just for testing basically i want run cron job dailiy at 1PM IST.
Quote:
|
Quote:
|
All times are GMT -5. The time now is 03:33 AM. |