0 0 * * * find /home/opt/gitlab/backups -name '*_gitlab_backup.tar' -mtime +1 |xargs rm -rf CRON=1
0 1 * * * find /home/opt/gitlab/backups -name 'gitlab.conf.backup.*' -mtime +2 |xargs rm -rf CRON=1
0 1 * * * tar -cf /tmp/gitlab.conf.backup.`date +%Y%m%d%H%M`.tar /etc/gitlab /var/opt/gitlab/nginx/conf
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1
#0 4 * * * sh /var/opt/gitlab/backups/gitlab_bakupToRemote.sh CRON=1
0 4 * * * sh /home/opt/gitlab/backups/gitlab_backup_to_remote.sh >> /home/opt/gitlab/backups/gitlab_backup_to_remote.log 2>&1 &
/home/opt/gitlab/backups/gitlab_conf_backup.sh
#!/bin/sh
tar -cPf /tmp/gitlab.conf.backup.`date +%Y%m%d%H%M`.tar /etc/gitlab /var/opt/gitlab/nginx/conf
/home/opt/gitlab/backups/gitlab_backup_to_remote.sh
#!/bin/sh
cd /home/opt/gitlab/backups/
scp `ls *_gitlab_backup.tar| tail -n 1` zyzx@192.168.21.15:/home/zyzx/gitlab_backups_21.14
cd /tmp
scp `ls gitlab.conf.backup* | tail -n 1` zyzx@192.168.21.15:/home/zyzx/gitlab_backups_21.14
网友评论