mysql 备份数据脚本
#!/bin/bash
for i in db1 db2 db3;
do
/usr/local/mysql/bin/mysqldump -uroot -p123456 -P3306 -R --databases $i > $i"_`date +%Y%m%d`.sql"
echo $i is backed;
done
设备定时任务 crontab -e
0 1 * * * sh /opt/backup/backup.sh
查询定时任 crontab -l
mysql 备份数据脚本
#!/bin/bash
for i in db1 db2 db3;
do
/usr/local/mysql/bin/mysqldump -uroot -p123456 -P3306 -R --databases $i > $i"_`date +%Y%m%d`.sql"
echo $i is backed;
done
设备定时任务 crontab -e
0 1 * * * sh /opt/backup/backup.sh
查询定时任 crontab -l