samba_backup: check that directory really exists
authorMatthieu Patou <mat@matws.net>
Sat, 11 Jun 2011 20:40:31 +0000 (00:40 +0400)
committerAndrew Tridgell <tridge@samba.org>
Thu, 21 Jul 2011 01:44:35 +0000 (11:44 +1000)
source4/scripting/bin/samba_backup

index 56125789d86e9c05343e16784578eda5c2fb8f92..75ebec66e34c46adde0f0b04b45c3d9d3f56f6cc 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (C) Matthieu Patou <mat@matws.net> 2010
+# Copyright (C) Matthieu Patou <mat@matws.net> 2010-2011
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -34,6 +34,16 @@ DIRS="private etc sysvol"
 DAYS=90
 WHEN=`date +%d%m%y`
 
+if [ ! -d $WHERE ]; then
+       echo "Missing backup directorty $WHERE"
+       exit 1
+fi
+
+if [ ! -d $FROMWHERE ]; then
+       echo "Missing or wrong provision directorty $FROMWHERE"
+       exit 1
+fi
+
 cd $FROMWHERE
 for d in $DIRS;do
        relativedirname=`find . -type d -name "$d" -prune`