#!/bin/sh
#
# uback main script. calls the other
# ones on request (usually via cron)
#
# $Revision: 1.2 $

# global config
conf=/etc/uback.conf

. $conf

action=$1
shift

case $action in
	"")

	    ;;
	--help|-h)
	    detail=$1
	    if [ "x$detail" = "x" ]; then
		echo "usage: uback <action>"
		echo "       the following actions are available:"
		for act in `$ls $base/bin`
		do
		    echo "       $act"
		done
		echo "       for action specific help type:"
		echo "       uback --help <action>"
	    else
		[ -x $base/bin/$detail ] || (echo "Error unknown action $detail"; exit 1) && ($base/bin/$detail --help; exit;) 
	    fi
	    ;;
	 *)
	    if [ -x "$base/bin/$action" ]; then
		decho "running $0 $action" >> $globallog
		$base/bin/$action $conf $* >> $globallog 2>&1
		decho "$action complete." >> $globallog
	    else
		decho "Error: unknown action $action." >> $globallog
	    fi
	    ;;
esac
	
	 
