rss logo

Intro

Here is a Bourne shell script which allow to redo rsync hardlink from old backup.

Code

#! /bin/sh
# rsync_hardlink_redo version 1.0
# 2015.10.22  shebangthedolphins.net first version
#---------------------------------------------------
# this script redo hardlink from incremental rsync backup
#---------------------------------------------------

#!/bin/sh

# Source work
PW="/volume1/BACKUP/"

for i in $(ls $PW | grep -v "current")
do 
        echo "----------BEGINNING-------------------"
        fichier_cur="$i"

        if [ "a$fichier_last" = "a" ]
        then
                echo "ne rien faire"
                fichier_last="$fichier_cur"
        else
                echo "----------------------------------"
                mv "$PW"/"$fichier_cur" "$PW"/TEMP
                echo "rsync -a --log-file=/tmp/rsync.log --remove-source-files --size-only --stats --link-dest="$PW"/"$fichier_last" "$PW"/TEMP/ "$PW"/"$fichier_cur""
                rsync -a --log-file=/tmp/rsync.log --remove-source-files --size-only --stats --link-dest="$PW"/"$fichier_last" "$PW"/TEMP/ "$PW"/"$fichier_cur"
                echo "----------------------------------"
                echo "fichier_last : $fichier_last"
                echo "fichier_cur : $fichier_cur"
                fichier_last="$fichier_cur"
                echo "suppression du fichier "$PW"/TEMP"
                rm -rf "$PW"/TEMP
                echo "-------------END----------------------"
        fi
done
Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Contact :

contact mail address