You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#!/bin/bash
|
|
location="/usr/local/Backup"
|
|
# 创建一个备份目录
|
|
mkdir -p $location
|
|
# 备份一个SQL类型的
|
|
date_str=`date +%Y%m%d%H%M%S`
|
|
tar zcvf $location/gogs_$date_str.tar.gz /usr/local/gogs
|
|
# 删除原文件(删除超过30天的)
|
|
find $location -mtime +30 -type d |xargs rm -rf |