Created
September 27, 2018 05:07
-
-
Save taka3110/934ebef86450c827981d60c603e3fb1a to your computer and use it in GitHub Desktop.
システムバックアップサンプル
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 | |
######################## | |
###### Base info | |
######################## | |
NEWDATE=`/bin/date --date='today' +%Y%m%d` | |
DELDATE=`/bin/date --date='7 days ago' +%Y%m%d` | |
BACKUPDIR=/your/path | |
LIST="/tmp/list$$.txt" | |
######################## | |
#EOFからEOFに挟んでいるエリアがバックアップ対象 | |
cat > "$LIST" <<EOF | |
/etc | |
/root/.ssh | |
/var/spool/cron | |
EOF | |
tar cvfzT $BACKUPDIR/`/bin/hostname`_backup.$NEWDATE.tgz "$LIST" | |
rm -f "$LIST" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment