Imported Upstream version 2.5.1
[debian/amanda] / server-src / amdump.sh.in
index 28ba2a5ed95ea1c5a73d65bc793ecda9aebf498a..a66e6b2cc4dfd50f720df5ce7a3c644b4244fbbb 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!@SHELL@
 #
 # Amanda, The Advanced Maryland Automatic Network Disk Archiver
 # Copyright (c) 1991-1998 University of Maryland at College Park
@@ -47,20 +47,28 @@ else
        SUF=
 fi
 
+if [ $# -lt 1 ]
+then
+        echo "Usage: amdump config [host [disk...]...]" 1>&2
+        exit 1
+fi
+
+
 conf=$1
 if [ ! -d $confdir/$conf ]; then
-    echo "amdump$SUF: could not find directory $confdir/$conf"
+    echo "amdump$SUF: could not find directory $confdir/$conf" 1>&2
     exit 1
 fi
+shift
 
 cd $confdir/$conf || exit 1
 
-logdir=`amgetconf$SUF $conf logdir`
+logdir=`amgetconf$SUF $conf logdir "$@"`
 [ $? -ne 0 ]  && exit 1
 errfile=$logdir/amdump
-tapecycle=`amgetconf$SUF $conf tapecycle`
+tapecycle=`amgetconf$SUF $conf tapecycle "$@"`
 [ $? -ne 0 ]  && exit 1
-dumpuser=`amgetconf$SUF $conf dumpuser`
+dumpuser=`amgetconf$SUF $conf dumpuser "$@"`
 [ $? -ne 0 ]  && exit 1
 
 runuser=`{ whoami ; } 2>/dev/null`
@@ -73,20 +81,20 @@ if [ $? -ne 0 ]; then
        fi
 fi
 
-if [ $runuser != $dumpuser ]; then
-       echo "amdump: must be run as user $dumpuser, not $runuser"
-       exit 1
-fi
+#if [ $runuser != $dumpuser ]; then
+#      echo "amdump: must be run as user $dumpuser, not $runuser" 1>&2
+#      exit 1
+#fi
 
 if test -f hold; then
-       echo "amdump: waiting for hold file to be removed" >&2
+       echo "amdump: waiting for hold file to be removed" 1>&2
        while test -f hold; do
                sleep 60
        done
 fi
 
 if test -f $errfile || test -f $logdir/log; then
-       echo "amdump: amdump or amflush is already running, or you must run amcleanup" >&2
+       echo "amdump: amdump or amflush is already running, or you must run amcleanup" 1>&2
        exit 1
 fi
 
@@ -98,20 +106,20 @@ touch $errfile
 exec </dev/null 2>>$errfile 1>&2
 echo "amdump: start at `date`"
 echo "amdump: datestamp `date +%Y%m%d`"
-$libexecdir/planner$SUF "$@" | $libexecdir/driver$SUF $conf
+$libexecdir/planner$SUF $conf "$@" | $libexecdir/driver$SUF $conf "$@"
 echo "amdump: end at `date`"
 
 # Send out a report on the dumps.
-$sbindir/amreport$SUF $conf
+$sbindir/amreport$SUF $conf "$@"
 
 # Roll the log file to its datestamped name.
-$libexecdir/amlogroll$SUF $conf
+$libexecdir/amlogroll$SUF $conf "$@"
 
 # Trim the log file to those for dumps that still exist.
-$libexecdir/amtrmlog$SUF $conf
+$libexecdir/amtrmlog$SUF $conf "$@"
 
 # Trim the index file to those for dumps that still exist.
-$libexecdir/amtrmidx$SUF $conf
+$libexecdir/amtrmidx$SUF $conf "$@"
 
 # Keep a debug log through the tapecycle plus a couple of days.
 maxdays=`expr $tapecycle + 2`