/
backup_home_cleanup
executable file
·30 lines (24 loc) · 1.1 KB
/
backup_home_cleanup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
DISPLAY=:0.0
export DISPLAY
if [ `/sbin/ifconfig eth0 | grep inet | grep -v inet6 | wc -l` -lt 1 ]; then
echo "Your eth0 interface is not up, so let's not overcrowd the wifi..." >> /home/gsacre/var/log/backup.log
exit 1
fi
if [ `grep -i softkinetic /etc/resolv.conf | wc -l` -lt 1 ]; then
echo "You are not on the Softkinetic network... I go back to sleep..." >> /home/gsacre/var/log/backup.log
exit 2
fi
if [ ! -d /mnt/u/backup_home ]; then
echo "Your personal folder is not mounted. Mounting..." >> /home/gsacre/var/log/backup.log
mount /mnt/u
fi
if [ ! -d /mnt/u/backup_home ]; then
echo "Ok, it seems we have a serious problem... Exiting..." >> /home/gsacre/var/log/backup.log
exit 1
fi
notify-send -u low "BACKUP" "Starting cleanup of HOME backups"
echo "Cleanup of /home/gsacre backup starting at `date`" >> /home/gsacre/var/log/backup.log
duplicity remove-older-than 12W file:///mnt/u/backup_home >> /home/gsacre/var/log/backup.log
echo "Cleanup of /home/gsacre backup finished at `date`" >> /home/gsacre/var/log/backup.log
notify-send -u low "BACKUP" "Finished cleanup of HOME backups"