Date Series Part 3 of script Tags bash / script

I've moved over to Gnome from KDE and I now prefer it and find it easy to use. As part of the move over I've changed my backup script, which is now -

USB_DIR="/media/8eef3b99-c17b-4913-ae61-d34c7fd5d459_"
 BACKUP_DIR="$USB_DIR/$(/bin/date +%Y%m%d)"
 if [ -d $USB_DIR ]; then
 [ -d $BACKUP_DIR ] || mkdir $BACKUP_DIR \
 >> /home/boztu/cron/backup.txt 2>&1
 /usr/bin/rsync -avz \
 --exclude-from '/home/boztu/cron/xclude.txt' \
 /home/boztu/ $BACKUP_DIR \
 >> /home/boztu/cron/backup.txt 2>&1
 fi

As can be seen there is just one script and one target drive, which makes it very simple to maintain, and requires very little maintenance too.

But it now uses an external 'exclude' script, which contains the following -

*.mp2
 *.ogg
 *.part
 *.avi
 *.rar
 *.mkv
 *.mp3
 *.mp4
 *.wmv
 *.nfo
 *.deb

But there is a problem with the external usb hard drive in that it reverts its permissions to "root:root" at odd intervals, for some unknown reason. My solution to this is to run this "permissions" script at 2355 every night, just before the backup starts which changes the permissions to "root:boztu".

chown root:boztu /media/8eef3b99-c17b-4913-ae61-d34c7fd5d459_
chmod 775 /media/8eef3b99-c17b-4913-ae61-d34c7fd5d459_


Comments

comments powered by Disqus