diff options
| author | Moux <marlox@ouda.fr> | 2015-08-02 12:55:35 +0200 |
|---|---|---|
| committer | Moux <marlox@ouda.fr> | 2015-08-02 12:55:35 +0200 |
| commit | 16382ecee75840ae6466a5dc6f973d367063d26b (patch) | |
| tree | fd2ef99b1703f8f86e1433269d98dded8ee19402 /bin/sync-volume | |
| download | misc-16382ecee75840ae6466a5dc6f973d367063d26b.tar.gz misc-16382ecee75840ae6466a5dc6f973d367063d26b.tar.bz2 misc-16382ecee75840ae6466a5dc6f973d367063d26b.zip | |
Ajout d'un script de synchronisation Enfs/SSHFS
Diffstat (limited to 'bin/sync-volume')
| -rwxr-xr-x | bin/sync-volume | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/bin/sync-volume b/bin/sync-volume new file mode 100755 index 0000000..2cab139 --- /dev/null +++ b/bin/sync-volume @@ -0,0 +1,35 @@ +#!/bin/bash + +PROFIL="${1}" +IS_AUTO="${2}" + +if [ ! -e "$HOME/.unison/${PROFIL}.prf" ] +then + echo "Le profil ${PROFIL} n'existe pas" >&2 + exit 1 +fi + +ROOT=$(grep -r "^root *=" $HOME/.unison/${PROFIL}.prf | sed -e 's/^root *= *//') +for dossier in ${ROOT} +do + if [ ! -x "${dossier}" ] + then + if [ -z "${IS_AUTO}" ] + then + echo "Le dossier ${dossier} n'est pas lisible" >&2 + exit 1 + else + exit 0 + fi + fi +done + + +if [ -z "${IS_AUTO}" ] +then + unison -ui text "${PROFIL}" +else + nodeletion=$(grep -r "^root *=" $HOME/.unison/${PROFIL}.prf | sed -e 's/root *=/-nodeletion/') + + unison -ui text -silent -batch $nodeletion "${PROFIL}" +fi |
