troubleshooting Question

cron.daily not running script

Avatar of tektools
tektools asked on
Shell Scripting
4 Comments1 Solution1821 ViewsLast Modified:
I have the following shell script called mydatabasedump in my cron.daily


source /etc/profile
source ~/.bashrc

/usr/bin/mysqldump --single-transaction  -uDBADMIN -pDBPASSWORD -P3306 -hlocalhost mydatabase >> /opt/db_backups/mydatabase.sql

mv /opt/db_backups/mydatabase.sql /opt/db_backups/mydatabase_`date +%A`.sql

I have crond turned on
[root@ttlicense-web cron.daily]# chkconfig --list | grep crond
crond           0:off   1:off   2:on    3:on    4:on    5:on    6:off

I have my file in cron.daily
[root@ttlicense-web cron.daily]# ls
0anacron   mydatabasedump makewhatis.cron  prelink  tmpwatch
0logwatch  logrotate      mlocate.cron     rpm

I used the default for crontab
[root@ttlicense-web etc]# cat crontab
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

but my shell script doesnt run, if I do an sh mydatabasedump in the cron.daily folder I am able to get the database dump. I am not sure what I am missing.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros