aboutsummaryrefslogtreecommitdiff
path: root/share/hydractl/sync-backups
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-08-03 09:18:39 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-08-03 09:18:39 -0300
commitf8cb5c3346d1a4de1fd4d9322dd58ee56519954c (patch)
tree0e349e7d04113bc8da0f0408eaa084c09ce154e4 /share/hydractl/sync-backups
parent574a7485c21ee6b45a48e8fe57f1150bd8e4c556 (diff)
downloadhydra-f8cb5c3346d1a4de1fd4d9322dd58ee56519954c.tar.gz
hydra-f8cb5c3346d1a4de1fd4d9322dd58ee56519954c.tar.bz2
Check volume name and if it is mounted at sync-backups
Diffstat (limited to 'share/hydractl/sync-backups')
-rwxr-xr-xshare/hydractl/sync-backups12
1 files changed, 12 insertions, 0 deletions
diff --git a/share/hydractl/sync-backups b/share/hydractl/sync-backups
index c04fa2f..b218b5c 100755
--- a/share/hydractl/sync-backups
+++ b/share/hydractl/sync-backups
@@ -64,6 +64,18 @@ else
shift
fi
+# Check volume name
+if [ "$VOLUME" == "`hostname -f`" ];
+ echo "volume is the hostname, cannot sync to myself"
+ exit 1
+fi
+
+# Check if it is mounted
+if ! mount | grep -q $MEDIA; then
+ echo "volume $MEDIA is not mounted"
+ exit 1
+fi
+
# Detect if removable media is a system or a regular storage volume
if [ -d "$MEDIA/var/backups/remote" ]; then
MEDIA="$MEDIA/var/backups/remote"