Listing 3: startappl2
#!/bin/sh
#################################################################
# "@(#)startappl2"
# Shellprogram : startappl2
# Description : Check that the users are included in the group
# Function : If fgrep gets a true value from id then the
# : users are authorized. Use parameterfil
# : ../etc/appl2_anv.conf to choose right menu
# : for user.
# Date : 991009
# Author : Mats Brymér WM-data
# Version : 1.0
#################################################################
#
# Shell variable
#
TOP=/usr/local;export TOP
LOG=$TOP/log/startappl2;export LOG
BIN=$TOP/bin;export BIN
STARTVAL=$TOP/etc/appl2_anv.conf
SHELL=/bin/sh;export SHELL
#
# Check that users are included in the group appl2
#
# id -a is for Solaris, other operating systems don't
# need this.
#
if id -a | fgrep appl2 > /dev/null
then
#
# If true, write to logfile
#
echo `date`,`id`,$TERM >>$LOG
#
# Choose which menu to start
#
if grep $LOGNAME $STARTVAL >/dev/null
then
MENY=`grep $LOGNAME $STARTVAL|cut -d":" -f2`
TERM=vt220;export TERM
$MENY
else
#
# If the user is not present in the appl2_anv.conf file.
# There is a message on the screen. And a logpost is
# written to logfile. After this, the session is closed
#
echo "You are not registred"
echo "CHECK,`date`,`id`,$STARTVAL" >>$LOG
exit 1
fi
#
# If the user is not included in the group appl2. There
# is a message on the screen to the user. And a logpost
# is written. After that, the session is ended.
#
else
echo "Access denied"
echo "CHECK,`date`,`id`,$TERM">>$LOG
exit
fi
|