#!/bin/sh

today=`date --date='0 days ago' +%Y%m%d`
day_del=`date --date='100 days ago' +%Y%m%d`

 

mysql_dir_rep=/mnt/diskb/Backup/mysql
conf_dir_rep=/mnt/diskb/Backup/conf

#备份配置文件
scp /etc/hosts /etc/profile /etc/resolv.conf /home/dp/.hiverc ${conf_dir_rep}/


#备份cloudera-scm-service-db
scp bdcv28:/tmp/scm_server_db_backup* /diskb/Backup/cloudera-scm_server_db/

#打包文件

ssh -t -p 22 10.130.2.21 "
today=`date --date='0 days ago' +%Y%m%d`
zip -r /home/dp/bdc21-diskc-nn-$today.zip /diskc/dfs/nn
"
scp -r root@bdc21:/home/dp/bdc21-diskc-nn-$today.zip ${nn_dir_rep}

#备份rundeck数据库
mysqldump -h 10.130.2.248 -urundeck -prundeck rundeck | gzip > ${mysql_dir_rep}/rundeck_db_backup-$today.sql.gz

 

if [ -e ${mysql_dir_rep}/rundeck_db_backup-${day_del}.sql* ]   //定期删除
then rm -f ${mysql_dir_rep}/rundeck_db_backup-${day_del}.sql*
fi

 

posted on 2017-04-10 19:21  流浪在伯纳乌  阅读(155)  评论(0编辑  收藏  举报