Advertisement

05.21.2008 at 01:26PM PDT, ID: 23422395
[x]
Attachment Details

cron.daily not running script

Asked by tektools in Shell Scripting

Tags: CentOS, 5

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
[+][-]05.22.2008 at 04:25AM PDT, ID: 21622740

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Shell Scripting
Tags: CentOS, 5
Sign Up Now!
Solution Provided By: JustUNIX
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.22.2008 at 05:46AM PDT, ID: 21623242

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.22.2008 at 06:21AM PDT, ID: 21623543

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.23.2008 at 01:10AM PDT, ID: 21630282

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628