Add new file
This commit is contained in:
14
gauntmta_backup.sh
Normal file
14
gauntmta_backup.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
#We can work out if the day of the week with date +%a Mon Tue Wed Thu Fri Sat Sun
|
||||
DAY=$(date +%a)
|
||||
FILE=data
|
||||
SNAR=${FILE}.snar
|
||||
TAR=~/${FILE}.${DAY}.tar.gz
|
||||
|
||||
#If it is Monday we need to make sure that we start with a new snar file to ensure full #backup
|
||||
#If the snar file is there it is renamed with a date extension of the previous Monday
|
||||
if [ $DAY = 'Mon' ]
|
||||
then
|
||||
test -e ~/$SNAR && mv $SNAR ${SNAR}.$(date --date '7 days ago' +%F)
|
||||
fi
|
||||
tar -czg ~/$SNAR -f $TAR ~/$FILE
|
||||
Reference in New Issue
Block a user