From 46bafeec04b12098cee7a7e2a49a50a61d73b644 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 17 Aug 2007 01:11:04 +0000 Subject: [PATCH] =?utf8?q?fikset=20backupscript=20til=20=C3=A5=20varsle=20?= =?utf8?q?dersom=20m=C3=A5lfilesystemet=20tilfeldigvis=20er=20rot=20(/)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- backup.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/backup.sh b/backup.sh index a5cc915..bf9c59a 100755 --- 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. -- 2.39.2