Last active
January 19, 2018 06:12
-
-
Save the-eric-kwok/b30931438382e416fd5a184bdcec08d8 to your computer and use it in GitHub Desktop.
auto backup spigot dir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATE=`date '+%F'` #获取当前日期 | |
DEL-DATE="30" #自动删除30天以前的备份 | |
BACKUP_DIR="./share/spigot_backup" #备份目录 | |
tar -zcvf "$DATE-spigot.tar.gz" ~/spigot | |
if [ ! -d "$BACKUP_DIR" ]; then | |
mkdir "$BACKUP_DIR" | |
fi | |
mv *-spigot.tar.gz "$BACKUP_DIR" | |
find "$BACKUP_DIR" -mtime "+$DEL-DATE" -exec "rm {} \" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment