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...
Here is the script: #!/bin/bash BACKUP_DIR="/media/disk/AUTOMATED_BACKUPS/DB_DAILY" CURRENT_DIR=$BACKUP_DIR/`date +%d` DATABASES="$(/usr/bin/mysql -uUsername -pPassword -Bse 'show databases')" echo 'Backing up databases: '$DATABASES if [ -e "$CURRENT_DIR" ] then cd $CURRENT_DIR /bin/rm * else /bin/mkdir $CURRENT_DIR cd $CURRENT_DIR fi for DB in $DATABASES do /usr/bin/mysqldump -uroot -pHardAsMySql321 "$DB" | bzip2 > "$DB"_`date +%Y-%m-%d_%k.%M`".sql.bz2" done exit 0 Can any skilled eyes see why this doesn't work when it is run from the roots crontab? Additionally, when I run the script as root in the terminal, I get the following output: Backing up databases: information_schema db1 db2 db3 /bin/rm: cannot remove `*': No such file or directory Is there a better way to clear out last months files before making the current backups? Thanks for any help in advance... -- View this message in context: http://www.nabble.com/Help-with-script---doesn%27t-work-properly-from-cron-tp24542164p24542164.html Sent from the Gnu - Bash mailing list archive at Nabble.com.