cronjob not running!
Hi Guyz,
I created a cronjob in Linux 2.6 but it is not triggering at the specified time, The crontab entry is like this. ------------------------- #Sheduled backup job. #Backup the database [ daily at midnight ] 3 2 * * * ~/db.sh 2>&1 >> ~/_backup/db.log ------------------------------------------- The background process crond is also running. [root@cc1001-ehealth cron.daily]# ps -ef | grep cron root 3044 1 0 May12 ? 00:00:00 crond root 3731 28629 0 08:20 pts/1 00:00:00 grep cron PLEASE help, what to do to run a script using cron job? |
The script is running fine when fired manually. The script is also running from the other user accounts cronjob. I want to run the script from the root user account, I copied the script to root user's home and then created the cronjob but the script is not triggering at the given time.
|
Hi, welcome to LQ!
db.sh & comments suggest database involvement ... Is there anything in the other user accounts environment set that roots account is missing? Cheers, Tink |
Yes the script is taking the backup of mySql database and everything related to the database is provided in the script. The same script is running from other user account and no environment settings are used for that. And also from the root user the script is running when fired manually but not from the cronjob. I want to run the script from root user's cronjob. The job is not even triggering. Please tell me whether I am missing something?
Thanks & Regards. |
try to use the whole path to the commands.
|
Code:
3 2 * * * ~/db.sh 2>&1 >> ~/_backup/db.log Then just reverse the two redirections in order to have both stdout and stderr sent to the log file: Code:
3 2 * * * ~/db.sh >> ~/_backup/db.log 2>&1 |
Thanks Colucix and all,
I changed the standard error redirection as suggested by Colucix and it worked. Thanks. |
All times are GMT -5. The time now is 06:10 PM. |