4 ms·
This is the incremental backup script I use on my Linux box at home, a quick-and-dirty imitation of what Time Machine does. Obviously $HOME/backup is a differen
by diego 17y ago
This is the incremental backup script I use on my Linux box at home, a quick-and-dirty imitation of what Time Machine does. Obviously $HOME/backup is a different physical disk. Feel free to improve on this.
--------
#!/bin/bash
HOME=
date=`date "+%Y-%m-%dT%H:%M:%S"`
rsync -aP --link-dest=$HOME/backup/current /home
$HOME/backup/back-$date
rsync -aP --link-dest=$HOME/backup/current /etc $HOME/backup/back-$date
rm $HOME/backup/current
ln -s back-$date $HOME/backup/current
#see if the disk is getting full
FREE=`df -lk|grep sdb1|awk -F" " '{print $5}'|awk -F"%" '{print $1}'`
#alert me if the backup disk is getting full.
T=80
if [ "$FREE" -gt "$T" ]
then
df -lk| mail $myaddress -s"disk alert $T% capacity"
else
echo "backup disk is less than $T full"
fi
- Locke1689 17y agoYou should think about keeping an offsite backup if possible. A second disk won't necessarily help if your computer gets dropped in a pool, house catches on fire, etc.