Updated nasbackup.sh
This commit is contained in:
parent
611d51dd61
commit
aef6f9515c
13
nasbackup.sh
13
nasbackup.sh
@ -1,22 +1,29 @@
|
||||
#!/bin/bash
|
||||
#apps backup downloads fun games movies mp3s tvshows wow
|
||||
|
||||
mkdir -p /var/log/nasbackup
|
||||
|
||||
FROMADDRESS=mmckinnon@comprofix.com
|
||||
TOADDRESS=mmckinnon@comprofix.com
|
||||
SMTP=mail.comprofix.com
|
||||
|
||||
BODSUBJECT="Backup Log `date +%d-%m-%Y`"
|
||||
LOGFOLDER=/var/log/nasbackup
|
||||
N_DAYS=7
|
||||
|
||||
|
||||
LOG=/home/moe/scripts/logs/backuplog-`date +%d-%m-%Y`.log
|
||||
|
||||
LOG=$LOGFOLDER/backuplog-`date +%d-%m-%Y`.log
|
||||
echo "****************************************************************" > $LOG 2>&1
|
||||
echo "* Start Backup `date` *" >> $LOG 2>&1
|
||||
echo "****************************************************************" >> $LOG 2>&1
|
||||
|
||||
rsync -rltDyzPOu --progress --delete /data/ /mnt/nas/ >> $LOG 2>&1
|
||||
rsync -rltDyzPOu --progress --delete /data/fun /mnt/nas >> $LOG 2>&1
|
||||
|
||||
echo "****************************************************************" >> $LOG 2>&1
|
||||
echo "* Finished Backup `date` *" >> $LOG 2>&1
|
||||
echo "****************************************************************" >> $LOG 2>&1
|
||||
|
||||
sendemail -f "NAS BACKUP <$FROMADDRESS>" -t $TOADDRESS -u "$BODSUBJECT" -m "$BODSUBJECT" -a $LOG -s $SMTP >> $LOG 2>&1
|
||||
|
||||
find $LOGFOLDER/* -mtime +$N_DAYS -exec rm {} \;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user