Thanks everyone for your pointers - I ended up with this:
#!/bin/bash
BACKUP_DIR="/media/disk/AUTOMATED_BACKUPS/DB_DAILY"
CURRENT_DIR=$BACKUP_DIR/`date +%d`
DATABASES="$(mysql -uroot -pNewSecretPw -Bse 'show databases')"
echo 'Backing up databases: '$DATABASES
cd /
rm -rf "$CURRENT_DIR"
mkdir
Greg Wooledge wrote:
> Erik Olof Wahlstrom wrote:
> > /usr/bin/mysqldump -uroot -pHardAsMySql321 "$DB" | bzip2 >
> > "$DB"_`date +%Y-%m-%d_%k.%M`".sql.bz2"
>
> # Long line, probably broken by your mailer. For clarity, I'd
># write it on two lines explicitily:
>
>
On Fri, Jul 17, 2009 at 02:53:21PM -0700, Erik Olof Wahlstrom wrote:
> #!/bin/bash
> BACKUP_DIR="/media/disk/AUTOMATED_BACKUPS/DB_DAILY"
>
> CURRENT_DIR=$BACKUP_DIR/`date +%d`
# See how you call date here without an explicit path? That's good.
> DATABASES="$(/usr/bin/mysql -uUsername -pPasswo
Erik Olof Wahlstrom schrieb:
Hello - I am having a problem with a backup script that I have put together -
when I run it as root from the terminal, it works as expected (with one
caveat); however, when cron runs it, the daily backup folder is created but
no files are deposited into that folder...