C#代码
- ### 把docker容器提交成新的镜像
- cd /data/backup
- ### 备份Jenkins容器
- docker commit -a "Jesse Liu" -m "v20230602" jenkins-rsync-v2 jenkins-rsync:v2b
- docker save -o jenkins-rsync-v2b.tar jenkins-rsync:v2b
- ### 备份Nginx容器
- docker commit -a "Jesse Liu" -m "v20230602" nginx-nodejs-redis-v2 nginx-nodejs-redis:v2b
- docker save -o nginx-nodejs-redis-v2b.tar nginx-nodejs-redis:v2b
- docker commit -a "Jesse Liu" -m "v20230602" jenkins-rsync-v2 jenkins-rsync:v2b
- docker save -o jenkins-rsync-v2b.tar jenkins-rsync:v2b
- docker commit -a "Jesse Liu" -m "v20230602" nginx-nodejs-redis-v2 nginx-nodejs-redis:v2b
- docker save -o nginx-nodejs-redis-v2b.tar nginx-nodejs-redis:v2b
- ### SHELL脚本依次压缩导出tgz文件
- cd /data/backup &&
- rm -rf jenkins-rsync-v2b.tgz &&
- rm -rf nginx-nodejs-redis-v2b.tgz &&
- docker rmi jenkins-rsync:v2b &&
- docker rmi nginx-nodejs-redis:v2b &&
- docker commit -a "Jesse Liu" -m "v20230602" jenkins-rsync-v2 jenkins-rsync:v2b &&
- docker image save jenkins-rsync:v2b > jenkins-rsync-v2b.tgz &&
- docker commit -a "Jesse Liu" -m "v20230602" nginx-nodejs-redis-v2 nginx-nodejs-redis:v2b &&
- docker image save nginx-nodejs-redis:v2b > nginx-nodejs-redis-v2b.tgz
- ### SHELL脚本依次解压导入docker镜像
- docker image load -i jenkins-rsync-v2b.tgz
- docker image load -i nginx-nodejs-redis-v2b.tgz
- ### 编辑和查看定时器配置
- crontab -e
- crontab -l
- 每星期六的晚上11 : 00 pm重启smb
- 0 23 * * 6 /etc/init.d/smb restart
- 每天的0:30重启smb
- 30 0 * * * /etc/init.d/smb restart
- 30 0 * * * root /sh/docker-backup.sh
- 一分钟执行一次
- */1 * * * * root /sh/test.sh
- */1 * * * * root /sh/test.sh
- ### 重启定时器服务
- chmod 755 /sh/test.sh
- chmod 755 /sh/docker-backup.sh
- chmod 755 /sh/scp-docker.sh
- systemctl restart crond