root's crontab and mysqldump

Peter Boosten peter at boosten.org
Mon Feb 23 10:41:56 PST 2009


Joseph Simmons wrote:
> I added the full path and the result didn't change. I can still see it
> running in the log but the script doesn't appear to be doing anything.
>
> I have the following variables set in the root's crontab
>
> SHELL=/usr/local/bin/bash
> PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin
> HOME=/root
>
> The file I'd like to execuate has the following permissions
>
> rwxr-x---
>
> it's own by root, the contents of the file are below
>
> #!/usr/local/bin/bash
> date_time=$(/bin/date "+%Y-%m-%d-%H-%M-%S")
>
> /usr/local/bin/mysqldump -u backup_user -pPassWord DataBase
>   
>> /backup/db/DataBase-$date_time
>>     
>
>   

I run the same script, however without the credentials. Those are in 
~/.my.cnf

[client]
user = backupuser
password = thepassword
host = the.host.name

my backup script:

*******
ra% cat bkupdb
#!/bin/sh

DATUM=`date +%Y%m%d`

nice -19 /usr/local/bin/mysqldump -A --single-transaction > 
/home/peter/backup/mysql-${DATUM}.sql
gzip /home/peter/backup/mysql-${DATUM}.sql
******

nb: DATUM = Dutch for date

Peter

-- 
http://www.boosten.org



More information about the freebsd-questions mailing list