I have the following shell script called mydatabasedump in my cron.daily
#!/bin/sh
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
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:
/usr/bin
MAILTO=root
HOME=/
# 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.
Start Free Trial