]> git.sesse.net Git - backup.sh/blobdiff - backup.sh
fikset backupscript til å varsle dersom målfilesystemet tilfeldigvis er rot (/)
[backup.sh] / backup.sh
index a5cc91570a4455e7f90a258a481f761295070fdb..bf9c59af7cb82db3057a95f51e49b2a0918c5503 100755 (executable)
--- a/backup.sh
+++ b/backup.sh
@@ -144,6 +144,15 @@ backup()
 for computer in $unixcomputers
 do
 ( 
+ # Check that the target filesystem is mounted 
+ # (actually check that it's not the root filesystem)
+ rootfilesystem=`df -P /`
+ targetfilesystem=`df -P "$storagedir/$computer"`
+ if [ "$rootfilesystem" == "$targetfilesystem" ]; then
+       echo `date`" $computer: Target filesystem ($storagedir/$computer) was mounted on /. Aborting"
+       continue
+ fi
+
  echo `date`" $computer: Backing up $computer" >&2
 
  # Try to SSH to the computer without entering a password.