# System Administration Menu
#
# Created:	 05-Sep-87
# Revision Date: 07-Nov-87
#
# Created By:	 Sandy Marshall
# Modified By:	 Sandy Marshall

# Edit DEFAULT as needed:
DEFAULT="q"

# Edit TITLE as needed:
TITLE="			System Administration Menu" 

if [ "`echo -n`" = "-n" ]
then
	NLF1=""
	NLF2="\c"
else
	NLF1="-n"
	NLF2=""
fi

while true
do

t=`pwd`
s=`date '+%a %h %d, 19%y'`
clear=`tput clear`

echo $clear

# SHOW ==================================================

cat << TBLOCK 
$TITLE

TBLOCK
echo "Present Directory: $t		Date: $s \n"
cat << SHOWEND
			a. User Administration
			b. Backup/Restore Menu
			c. System Functions Menu
			d. Printer/Terminal Maintenance
			e. System Accounting Menu
			f. Schedule a Job

			q. Return to Main Menu		? Help
SHOWEND
#
# Add additional lines before 'SHOWEND' and
# add corresponding entries in 'SELECT' below:
# <tab><letter(s)><tab><description"	# format for additional lines
#
# Use blank lines for visual grouping.
#

# ENTER ==================================================

echo $NLF1 "

				Select [$DEFAULT] :  $NLF2"
read SELECT

if [ -z "$SELECT" ]
then
	SELECT=$DEFAULT
fi

DEFAULT=$SELECT
RT="0"

echo $clear

# SELECT ==================================================

case $SELECT in
	a)	sh /usr/bin/user.sh
		EXERR=0					;;

	b)	sh /usr/bin/back.sh
		EXERR=0					;;

	c)	sh /usr/bin/function.sh
		EXERR=0					;;

	d)	sh /usr/bin/adptr.sh
		EXERR=0					;;

	e)	sh /usr/bin/sysacct.sh
		EXERR=0					;;

	f)	echo "Enter time the job is to be started: \c"
		read y
		if [ -n "$y" ]
		then	echo "Enter date if not today's date: \c"
			read z
			echo "Enter the name of the job you wish to schedule"
			echo "Terminate with a Control d\n"
			if [ -n "$z" ]
			then	at $y $z
				$x
				EXERR=$?
				sleep 5
			else	at $y
				$x
				EXERR=$?
				sleep 5
			fi
		else	EXERR=0
		fi					;;
	\?)	sh /usr/bin/admin.help
		EXERR=0
		RT=1					;;

	q)	exit $EXERR			 	;;

#
# Add additional lines here and
# add corresponding entries before 'SHOWEND' above:
# <tab><letter(s)>)<tab><cmd pathname> ; EXERR=$? ;;	# format
#

esac

if [ "$EXERR" != "0" ]
then
	echo $NLF1 " Exit error: $EXERR	$NLF2	"
	echo $NLF1 "  Press <RETURN> to continue:  $NLF2"
	read OK
else
	if [ "$RT" = "1" ]
	then
		echo $NLF1 " \n Press <RETURN> to continue:  $NLF2"
		read OK
	fi
fi

done
