gitlab备份

#!/bin/bash
backup_date=`date "+%Y_%m_%d"`
delete_date=`date +%Y_%m_%d -d "7 days ago"` 
backup_log=/home/yeemiao/shell/logs/gitlab_backup_${backup_date}.log


gitlab-rake gitlab:backup:create >${backup_log}

file_cnt=`find /var/opt/gitlab/backups -name "*${delete_date}*_gitlab_backup.tar"|wc -l`
echo $file_cnt
if [ $file_cnt -gt 1 ]
then
  find /var/opt/gitlab/backups -name "*${delete_date}*_gitlab_backup.tar"|xargs rm
fi

猜你喜欢

转载自www.cnblogs.com/hxlasky/p/10647588.html