linux脚本备份数据库,压缩,FTP下载
#!/bin/sh
month=`date +%m`
day=`date +%d`
year=`date +%Y`
#hour=`date +%k`
MYDATE=$year-$month-$day
mysqldump -h 127.0.0.1 -ucnrfadmin --default-character-set=latin1 -p123456 netoffice|gzip>/var/www/db_backup/db-$MYDATE.gz
cp -f /var/www/db_backup/db-$MYDATE.gz /var/www/db_backup/db-system.gz
ftp -n<<!
open ftp.server1.com
user ftpuser1 1232323
binary
prompt
put /var/www/db_backup/db-system.gz db-system.gz
close
bye
!