Ubuntu Pastebin

Paste from UnGeek at Wed, 7 Jan 2015 10:09:45 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#!/bin/bash
TIME=`date +"%F"`                   # time stamp to the backup file
TIME_SIX_AGO=`date --date="6 days" +%F`
FILENAME="backup_$TIME.tar.gz"      # defining the format of the file name while backing up
SRCDIR="/home/bungeecord"                # Location of the backup directory
DESDIR="/home/backupSerenia"             # Destination of the backup directory (where you need to backup)
tar -cpzf $DESDIR/$FILENAME $SRCDIR      # Executing the command
if [ -f /home/backupSerenia/backup_`$TIME_SIX_AGO`.tar.gz]
	then
		rm /home/backupSerenia/backup_`$TIME_SIX_AGO`.tar.gz
fi
Download as text