diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d9568ca --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*swp diff --git a/.synccmd.sh b/.synccmd.sh index b0f025f..ab08432 100755 --- a/.synccmd.sh +++ b/.synccmd.sh @@ -1,7 +1,23 @@ #!/bin/bash +# Copyright 2021 Luca Paris +#This file is part of masync. + +#masync is free software: you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation, either version 3 of the License, or +#(at your option) any later version. + +#masync is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. + +#You should have received a copy of the GNU General Public License +#along with masync. If not, see . + # $1 -> hash sync -# $2 -> LOCAL PATH -> /home/luca/test/ -# $3 -> REMOTE PATH -> notanamber@myvps:/home/notanamber/sydir/ [avoid to copy remote in source] +# $2 -> LOCAL PATH +# $3 -> REMOTE PATH -> user@myvps:/home/user/syncdir/ [trailing / avoids to copy remote folder in source] sync() { src=$2 dest=$3 diff --git a/syncdir.sh b/masync similarity index 92% rename from syncdir.sh rename to masync index 8d47d66..6d33288 100755 --- a/syncdir.sh +++ b/masync @@ -1,4 +1,20 @@ #!/bin/bash +# Copyright 2021 Luca Paris +#This file is part of masync. + +#masync is free software: you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation, either version 3 of the License, or +#(at your option) any later version. + +#masync is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. + +#You should have received a copy of the GNU General Public License +#along with masync. If not, see . + source ~/bin/.synccmd.sh SYNCFILE=~/.syncdir.sync MYPID=$$ @@ -9,16 +25,16 @@ RED="\e[31m" GREEN="\e[32m" ENDCOLOR="\e[0m" -HELP_CMD_NAME='syncdir.sh' +HELP_CMD_NAME='masync' HELP_LOCAL_DIR="/home/$USER/localsync/" HELP_REMOTE_DIR="remoteuser@server:/home/remoteuser/sync/" myhelp() { 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 '\tThis tool allows you to mirror and keep synchronised one or more folders on a remote server with arbitraries local folders.' echo -e '\tIt has three main commands init, start, stop, remove' - echo -e "\t${RED}NOTE: you must have configured ssh on your remote server!${ENDCOLOR}" + echo -e "\tNOTE: Before using it, you must have configured ssh on your remote server!" 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}" diff --git a/syncloop.sh b/syncloop.sh index ecbe6d1..1ae4e61 100755 --- a/syncloop.sh +++ b/syncloop.sh @@ -1,4 +1,20 @@ #!/bin/bash +# Copyright 2021 Luca Paris +#This file is part of masync. + +#masync is free software: you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation, either version 3 of the License, or +#(at your option) any later version. + +#masync is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. + +#You should have received a copy of the GNU General Public License +#along with masync. If not, see . + ## REQUIREMENT # apt-get install inotify-tools # @1 hash to retrieve sync