Hello,
i have a simple script to backup mysql with mysql dump but i have a strange behaviour and i'm not sure of cause...
my script is
strange behaviour is when i try to run
bash -x /root/backup-mysql.bash
this is output
so i have an error , and mysqldump not work...
but why script "rewrite"
'--password=1$2%3!a:b,c'
should be
/usr/bin/ionice -c3 /usr/bin/nice -n19 /usr/bin/mysqldump --user=root --password=1$2%3!a:b,c -P 3306 -h localhost --routines --triggers --events --quick --single-transaction --all-databases
or in alernative
/usr/bin/ionice -c3 /usr/bin/nice -n19 /usr/bin/mysqldump --user=root --password='1$2%3!a:b,c' -P 3306 -h localhost --routines --triggers --events --quick --single-transaction --all-databases
can you help me?
thank you
Alex
i have a simple script to backup mysql with mysql dump but i have a strange behaviour and i'm not sure of cause...
my script is
Bash:
#!/bin/bash
DATA=$(date +"%Y-%m-%d--%H-%M")
MYSQLDUMP=/usr/bin/mysqldump
BZIP2=/usr/bin/bzip2
IONICE=/usr/bin/ionice
NICE=/usr/bin/nice
MYSQL_USER=root
MYSQL_PASSWORD='1$2%3!a:b,c'
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_BACKUP_DIR=/mnt/remote/server
SECONDS=0
echo "...---...---...--- Start backup" $DATA | tee -a $LOG
echo "...---...---...--- Executing Database Backup" | tee -a $LOG
$IONICE -c3 $NICE -n19 $MYSQLDUMP --user=$MYSQL_USER --password=$MYSQL_PASSWORD -P $MYSQL_PORT -h $MYSQL_HOST --routines --triggers --events --quick --single-transaction --all-databases > $MYSQL_BACKUP_DIR/$DATA-restic-alldb-backup.sql 2> $MYSQL_BACKUP_DIR/$DATA-restic-alldb-backup.sql.err
if [ $? -ne 0 ]
then
echo "...---...---...--- Database Backup Failed" | tee -a $LOG
echo "...---...---...--- Stop backup" $DATA | tee -a $LOG
exit 2
else
$BZIP2 $MYSQL_BACKUP_DIR/$DATA-alldb-backup.sql
echo "...---...---...--- Database Backup Successful" $DATA | tee -a $LOG
sync;sync
fi
exit
strange behaviour is when i try to run
bash -x /root/backup-mysql.bash
this is output
Code:
..............
...---...---...--- Executing Database Backup
+ /usr/bin/ionice -c3 /usr/bin/nice -n19 /usr/bin/mysqldump --user=root '--password=1$2%3!a:b,c' -P 3306 -h localhost --routines --triggers --events --quick --single-transaction --all-databases
so i have an error , and mysqldump not work...
but why script "rewrite"
'--password=1$2%3!a:b,c'
should be
/usr/bin/ionice -c3 /usr/bin/nice -n19 /usr/bin/mysqldump --user=root --password=1$2%3!a:b,c -P 3306 -h localhost --routines --triggers --events --quick --single-transaction --all-databases
or in alernative
/usr/bin/ionice -c3 /usr/bin/nice -n19 /usr/bin/mysqldump --user=root --password='1$2%3!a:b,c' -P 3306 -h localhost --routines --triggers --events --quick --single-transaction --all-databases
can you help me?
thank you
Alex