Created
March 29, 2015 12:05
-
-
Save videogramme/02f64c4fa4e4208e9449 to your computer and use it in GitHub Desktop.
backup bash rsync script
This file contains hidden or 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
### https://linuxfr.org/forums/general-cherche-logiciel/posts/resolu-backup-oui-c-est-une-vielle-problematique ### | |
#!/bin/sh | |
date=`date "+%Y%m%d-T%H%M%S"` | |
# Attention au / | |
SOURCE_DIR=/home/denis/ | |
TARGET_HOST=192.168.0.4 | |
TARGET_USER=rsync | |
TARGET_DIR=/volume1/persosave/rsync/denis | |
time rsync --archive --one-file-system --hard-links \ | |
--human-readable --inplace \ | |
--partial --progress \ | |
--delete-excluded \ | |
--exclude-from=$SOURCE_DIR/script/rsync-exclude \ | |
--link-dest=$TARGET_DIR/current \ | |
$SOURCE_DIR $TARGET_USER@$TARGET_HOST:$TARGET_DIR/incomplete_back-$date | |
if [ $? -eq 0 ]; then | |
ssh $TARGET_USER@$TARGET_HOST "mv $TARGET_DIR/incomplete_back-$date $TARGET_DIR/back-$date \ | |
&& rm -f $TARGET_DIR/current \ | |
&& ln -s back-$date $TARGET_DIR/current"; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment