help
This commit is contained in:
parent
3492a82763
commit
73011c3593
11
syncdir.sh
11
syncdir.sh
@ -14,8 +14,7 @@ HELP_LOCAL_DIR="/home/$USER/localsync/"
|
||||
HELP_REMOTE_DIR="remoteuser@server:/home/remoteuser/sync/"
|
||||
|
||||
myhelp() {
|
||||
echo 'Synopsis: '
|
||||
echo -e "\t ${HELP_CMD_NAME} {COMMAND} [OPTION]"
|
||||
echo "Usage: ${HELP_CMD_NAME} {COMMAND} [OPTION]"
|
||||
echo 'Description: '
|
||||
echo -e '\tThis tool allows you to mirror and keep synchronised a folder on a remote server with an arbitrary local folder.'
|
||||
echo -e '\tIt has three main commands init, start, stop, remove'
|
||||
@ -23,11 +22,6 @@ myhelp() {
|
||||
echo -e "\tthe typical use is to start a sync with the command"
|
||||
echo -e "\t\t${HELP_CMD_NAME} init -l ${HELP_LOCAL_DIR} -r ${HELP_REMOTE_DIR}"
|
||||
echo -e "\tAbove command starts to mirror and sync the local folder ${HELP_LOCAL_DIR} with the remote folder ${HELP_REMOTE_DIR}"
|
||||
#'rsync -aP -e ssh /home/luca/googleDrive/Copy/Appunti/ notanamber@myvps:/home/notanamber/sydir'
|
||||
}
|
||||
|
||||
timestamp() {
|
||||
$(date +%s)
|
||||
}
|
||||
|
||||
hastrailingslash() {
|
||||
@ -52,7 +46,6 @@ syncexists() {
|
||||
|
||||
initsyncpath() {
|
||||
echo 'Starting initial sync...'
|
||||
#rsync -aP -e ssh "$remotepath" "$localpath"
|
||||
## write the file with remotepath and localpath for future use
|
||||
localpath_hash=$(echo "$1" | md5sum | cut -f1 --delimiter=" " -)
|
||||
sync $localpath_hash $2 $1
|
||||
@ -64,12 +57,10 @@ initsyncpath() {
|
||||
|
||||
startsyncpath() {
|
||||
echo 'Starting sync...'
|
||||
#rsync -aP -e ssh "$remotepath" "$localpath"
|
||||
## write the file with remotepath and localpath for future use
|
||||
localpath_hash=$(echo "$1" | md5sum | cut -f1 --delimiter=" " -)
|
||||
sync $localpath_hash $2 $1
|
||||
## create sync with status stopped -> after this start the loop
|
||||
#echo $localpath_hash "p$MYPID" w$(date +%s) $STATUS_STOPPED $1 $2 >> ${SYNCFILE}
|
||||
loopsyncpath $1
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user