From f8cb5c3346d1a4de1fd4d9322dd58ee56519954c Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 3 Aug 2017 09:18:39 -0300 Subject: Check volume name and if it is mounted at sync-backups --- share/hydractl/sync-backups | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'share/hydractl/sync-backups') 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" -- cgit v1.2.3