Listing 2: startappl1
#!/bin/sh
#################################################################
# "@(#)startappl1"
# Shellprogram : startappl1
# Description : Check that the users are included in the group
# Function : If fgrep gets a true value from id then the
# : users are authorized.
# Date : 991009
# Author : Mats Brymér WM-data AB
# Version : 1.0
#################################################################
#
# Shell variable
#
TOP=/usr/local;export TOP
LOG=$TOP/log/startappl1;export LOG
BIN=$TOP/bin;export BIN
SHELL=/bin/sh;export SHELL
#
# Check that users are included in the group appl1
#
# id -a is for Solaris, other operating system don't
# need this.
#
if id -a| fgrep appl1 > /dev/null
then
#
# If true, write to logfile
#
echo `date`,`id`,$TERM >>$LOG
#
# If there is a sysadmin for the application with a special
# menu, use this
#
#
# if [ $LOGNAME = appl1adm ]
# then
# TERM=vt220;export TERM
# exec $BIN/start.appl1adm
# else
# TERM=vt220;export TERM
# exec $BIN/start.appl1
# fi
#
# Start application
#
TERM=vt220;export TERM
exec $BIN/start.appl1
#
# If the users are not included in the group appl1. 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
|