better comments
This commit is contained in:
parent
4d4ef3a5c4
commit
6729906e5a
24
masync
24
masync
@ -125,8 +125,20 @@ initsyncpath() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# the start action is composed by
|
||||||
|
# 1. Checking the presence of the snapshot.
|
||||||
|
# Snapshot indicates the files present in origin (and in local path) when the sync was stopped
|
||||||
|
# if the snapshot is present we MUST check if all file in the snapshot are still present
|
||||||
|
# in origin. If not we must remove it from local folder feeding the deletes
|
||||||
|
#
|
||||||
|
# 2. Pushing a dummmy action into the queue to force an rsync from local folder to remote,
|
||||||
|
# For eventually new files
|
||||||
|
# 3. starting the loop listening for the changes in local folder
|
||||||
|
##########################################
|
||||||
|
|
||||||
startsyncpath() {
|
startsyncpath() {
|
||||||
echo -e "Starting mirror local folder ${GREEN}$1${ENDCOLOR} with remote ${GREEN}$2${ENDCOLOR}..."
|
echo -e "Start synching local folder ${GREEN}$1${ENDCOLOR} with remote ${GREEN}$2${ENDCOLOR}..."
|
||||||
localpath_hash=$(echo "$1" | md5sum | cut -f1 --delimiter=" " -)
|
localpath_hash=$(echo "$1" | md5sum | cut -f1 --delimiter=" " -)
|
||||||
snapshotfile=${SNAPSHOTFILE}${localpath_hash}
|
snapshotfile=${SNAPSHOTFILE}${localpath_hash}
|
||||||
tempqueuefile=~/.syncdir_${localpath_hash}.queue
|
tempqueuefile=~/.syncdir_${localpath_hash}.queue
|
||||||
@ -139,7 +151,7 @@ startsyncpath() {
|
|||||||
fi
|
fi
|
||||||
## ensure local computer sends eventually new files adding a fake line in the queue
|
## ensure local computer sends eventually new files adding a fake line in the queue
|
||||||
echo "Startsync DUMMY ACTION" >> ${tempqueuefile}
|
echo "Startsync DUMMY ACTION" >> ${tempqueuefile}
|
||||||
echo -e "Mirrorring ${GREEN}DONE${ENDCOLOR}"
|
echo -e "${GREEN}DONE${ENDCOLOR}"
|
||||||
loopsyncpath $1
|
loopsyncpath $1
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,6 +159,14 @@ readlog() {
|
|||||||
tail -f ~/syncloop_$1.nohup
|
tail -f ~/syncloop_$1.nohup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
# start the loop for synching local folder with remote folder.
|
||||||
|
# You can use as first argument the integer of sync or the local path.
|
||||||
|
# It spawn in background `syncloop.sh` and redirect stamdard output
|
||||||
|
# and standard error on syncloop_$hash.nohup
|
||||||
|
#
|
||||||
|
##########################################
|
||||||
|
|
||||||
loopsyncpath() {
|
loopsyncpath() {
|
||||||
echo -e "Starting loop for synching ${GREEN}$1${ENDCOLOR}"
|
echo -e "Starting loop for synching ${GREEN}$1${ENDCOLOR}"
|
||||||
re_num='^[0-9]+$'
|
re_num='^[0-9]+$'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user