Created
October 30, 2020 13:48
-
-
Save STrRedWolf/30da44ce701fbd5034c5f80fda83bffc to your computer and use it in GitHub Desktop.
Time Machine for every Unix scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
date=`date "+%Y-%m-%dT%H:%M:%S"` | |
rsync -aP --link-dest=$HOME/Backups/current /path/to/important_files $HOME/Backups/back-$date | |
rm -f $HOME/Backups/current | |
ln -s back-$date $HOME/Backups/current |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
date=`date "+%Y-%m-%dT%H_%M_%S"` | |
rsync -azPE --link-dest=PATHTOBACKUP/current $SOURCE $HOST:PATHTOBACKUP/back-$date \ | |
&& ssh $HOST "rm PATHTOBACKUP/current \ | |
&& ln -s back-$date PATHTOBACKUP/current" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
date=`date "+%Y-%m-%dT%H_%M_%S"` | |
HOME=/home/user/ | |
rsync -azP \ | |
--delete \ | |
--delete-excluded \ | |
--exclude-from=$HOME/.rsync/exclude \ | |
--link-dest=../current \ | |
$HOME user@backupserver:Backups/incomplete_back-$date \ | |
&& ssh user@backupserver \ | |
"mv Backups/incomplete_back-$date Backups/back-$date \ | |
&& rm -f Backups/current \ | |
&& ln -s back-$date Backups/current" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment