log and snapshot interactive
This commit is contained in:
parent
28277acb4f
commit
799a7078b2
@ -33,7 +33,7 @@ sync() {
|
||||
#echo "executing rsync -aPu --log-file=$LOGFILE -e ssh $otheropts $src $dest"
|
||||
# NOTE REMOTEDIR ALREADY EXISTS IN DESTINATION
|
||||
# in this form rsync receive only data from source 1>$syncloopfile 2>&1
|
||||
rsync -ni -aPu --progress --out-format="%i ${GREEN}%n%L${ENDCOLOR} %''b" --log-file=$logfile -e ssh $otheropts $src $dest | \
|
||||
rsync -i -aPu --progress --out-format="%i ${GREEN}%n%L${ENDCOLOR} %''b" --log-file=$logfile -e ssh $otheropts $src $dest | \
|
||||
grep -E "(<|>|deleting)" | \
|
||||
sed -E "s~<(\w|\W){10}~\\${PURPLE}\[SEND\]\\${ENDCOLOR} to remote ~g" | \
|
||||
sed -E "s~>(\w|\W){10}~\\${PURPLE}\[RECEIVE\]\\${ENDCOLOR} from remote ~g" | \
|
||||
|
30
masync
30
masync
@ -90,13 +90,31 @@ feeddeletes() {
|
||||
if [[ -e "${path}" ]]; then
|
||||
tocheckremotepath=$(echo "${path}" | sed -e "s~${localpath}~${remoterelativepath}~g")
|
||||
if ! grep -Fxq "${tocheckremotepath}" ${remotefiles}; then
|
||||
echo -e "${PURPLE}[PURGE]${ENDCOLOR} ${path} in snapshot no longer exists in remote";
|
||||
rm -rf "${path}"
|
||||
# echo -e "${PURPLE}[PURGE]${ENDCOLOR} ${path} in snapshot no longer exists in remote"
|
||||
echo -e -n "Do you want to remove ${RED}${path}${ENDCOLOR} from local sync? [y to remove, return to skip it, N no to all] "
|
||||
read -u 1 ui
|
||||
if [[ -z "${ui}" ]]; then
|
||||
if [ ${ui} = 'y' ]; then
|
||||
rm -rf "${path}"
|
||||
fi
|
||||
if [ ${ui} = 'N' ]; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo -e "${PURPLE}[PURGE]${ENDCOLOR} ${path} in snapshot no longer exists in local, delete in remote";
|
||||
## if controlled file doesn't exist in local delete it on remote
|
||||
echo "${path}" | sed -e "s~${localpath}~${remoterelativepath}~g" | tee -a ${queuedeletes}
|
||||
# echo -e "${PURPLE}[PURGE]${ENDCOLOR} ${path} in snapshot no longer exists in local, delete in remote"
|
||||
echo -e -n "Do you want to remove ${RED}${path}${ENDCOLOR} from remote origin? [y to remove, return to skip it, N no to all] "
|
||||
read -u 1 ui
|
||||
if [[ -z "${ui}" ]]; then
|
||||
if [ ${ui} = 'y' ]; then
|
||||
## if controlled file doesn't exist in local delete it on remote
|
||||
echo "${path}" | sed -e "s~${localpath}~${remoterelativepath}~g" | tee -a ${queuedeletes}
|
||||
fi
|
||||
if [ ${ui} = 'N' ]; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done < ${snapfile}
|
||||
rm -rf ${remotefiles}
|
||||
@ -145,7 +163,7 @@ startsyncpath() {
|
||||
tempqueuefile=$(format ${TMPQUEUEFILE} hash=${localpath_hash})
|
||||
|
||||
if [ -e ${snapshotfile} ]; then
|
||||
echo "Founded snapshot file: ${snapshotfile} collect files to delete in origin"
|
||||
echo "Founded snapshot file: ${snapshotfile} checking files to remove..."
|
||||
feeddeletes ${localpath_hash}
|
||||
echo "Remove snapshot file ${snapshotfile}"
|
||||
rm -f ${snapshotfile}
|
||||
|
Loading…
Reference in New Issue
Block a user