#!/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
阅读(1987) | 评论(0) | 转发(0) |