/
backup_mail_partial
executable file
·33 lines (27 loc) · 1.38 KB
/
backup_mail_partial
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
#!/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 try the wifi..." >> /home/gsacre/var/log/backup.log
if [ `/sbin/ifconfig wlan0 | grep inet | grep -v inet6 | wc -l` -lt 1 ]; then
echo "Your wlan0 interface is not up, I give up..." >> /home/gsacre/var/log/backup.log
exit 1
fi
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_mail ]; then
echo "Your personal folder is not mounted. Mounting..." >> /home/gsacre/var/log/backup.log
mount /mnt/u
fi
if [ ! -d /mnt/u/backup_mail ]; 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 incremental backup of MAIL"
echo "Backup incremental of /home/gsacre/Maildir starting at `date`" >> /home/gsacre/var/log/backup.log
duplicity incr --allow-source-mismatch --encrypt-key 0C3DCFF4 /home/gsacre/Maildir file:///mnt/u/backup_mail >> /home/gsacre/var/log/backup.log
echo "Backup incremental of /home/gsacre/Maildir finished at `date`" >> /home/gsacre/var/log/backup.log
notify-send -u low "BACKUP" "Ended incremental backup of MAIL"