知识库备份
#!/bin/bash source /etc/profile source ~/.bash_profile set -o nounset file=`date "+%Y_%m_%d" -d "1 day ago"` docker cp confluence:/var/atlassian/confluence/backups/backup-"$file".zip /data/shell/zsk/ docker exec confluence /bin/bash -c 'find /var/atlassian/confluence/backups -type f -mtime +2 -exec rm -f {} \;' scp /data/shell/zsk/backup-"$file".zip root@172.168.1.225:/data/zsk/confluence linshi=`ssh root@172.168.1.225 "ls /data/zsk/confluence |grep ".zip" | wc -l"` ssh -Tq root@172.168.1.225 << eeooff if [ $linshi -gt 3 ]; then find /data/zsk/confluence -type f -mtime +3 -name "*.zip" -exec rm -f {} \; fi exit eeooff unset linshi