/
backup_projects_full
executable file
·34 lines (28 loc) · 1.49 KB
/
backup_projects_full
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
31
32
33
34
#!/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 full backup of PROJECTS"
echo "Backup of /home/gsacre/projects starting at `date`" >> /home/gsacre/var/log/backup.log
cat /home/gsacre/projects/list_of_projects_to_backup | while read project; do
echo " Backup of /home/gsacre/projects/${project} starting at `date`" >> /home/gsacre/var/log/backup.log
duplicity full --allow-source-mismatch --encrypt-key 0C3DCFF4 /home/gsacre/projects/${project} file:///mnt/u/backup_projects/${project} >> /home/gsacre/var/log/backup.log
echo " Backup of /home/gsacre/projects/${project} finished at `date`" >> /home/gsacre/var/log/backup.log
done
echo "Backup of /home/gsacre/projects finished at `date`" >> /home/gsacre/var/log/backup.log
notify-send -u low "BACKUP" "Ended full backup of PROJECTS"