This commit is contained in:
Cameron (Kamran) Mashayekhi 2005-10-27 23:21:53 +00:00
parent 3012345ebd
commit 5f5e1c891c

View File

@ -1,88 +1,82 @@
#! /bin/sh #! /bin/sh
### BEGIN INIT INFO ### BEGIN INIT INFO
#Default-Start: 1 2 3 5 #Default-Start: 1 2 3 5
#Description: miCASA daemon #Description: miCASA daemon
### END INIT INFO ### END INIT INFO
MICASAD_BIN=/opt/novell/CASA/bin/micasad.sh MICASAD_BIN=/opt/novell/CASA/bin/micasad.sh
test -x $MICASAD_BIN || exit 5 test -x $MICASAD_BIN || exit 5
. /etc/rc.status . /etc/rc.status
# Shell functions sourced from /etc/rc.status: # Shell functions sourced from /etc/rc.status:
# rc_check check and set local and overall rc status # rc_check check and set local and overall rc status
# rc_status check and set local and overall rc status # rc_status check and set local and overall rc status
# rc_status -v ditto but be verbose in local rc status # rc_status -v ditto but be verbose in local rc status
# rc_status -v -r ditto and clear the local rc status # rc_status -v -r ditto and clear the local rc status
# rc_failed set local and overall rc status to failed # rc_failed set local and overall rc status to failed
# rc_reset clear local rc status (overall remains) # rc_reset clear local rc status (overall remains)
# rc_exit exit appropriate to overall rc status # rc_exit exit appropriate to overall rc status
# First reset status of this service # First reset status of this service
rc_reset rc_reset
case "$1" in case "$1" in
start) start)
echo -n "Starting miCASA daemon" echo -n "Starting miCASA daemon"
for file in "/etc/pam.d/login" "/etc/pam.d/sshd" "/etc/pam.d/xdm" "/etc/pam.d/gdm" "/etc/pam.d/kdm"
for file in "/etc/pam.d/login" "/etc/pam.d/sshd" "/etc/pam.d/xdm" "/etc/pam.d/gdm" "/etc/pam.d/kdm" do
do if [ -f $name ]
then
if [ -f $name ] awk '
then /auth/ { authSeen++; }
awk ' /account/ {
/auth/ { authSeen++; } if (!acctSeen && authSeen)
/account/ { {
if (!acctSeen && authSeen) print "auth\trequired\tpam_micasa.so\n";}
{ acctSeen++;
print "auth\trequired\tpam_micasa.so\n";} }
acctSeen++; /session/ { sesSeen++; }
} // {print $0; }
# /session/ { sesSeen++; } END { if (sesSeen)
// {print $0; } print "session\trequired\tpam_micasa.so\n"; }
END ' $file > $file.sav
# { if (sesSeen) mv $file.sav $file
# print "session\trequired\tpam_micasa.so\n"; } fi
' $file > $file.sav done
mv $file.sav $file startproc -f $MICASAD_BIN
fi # Remember status and be verbose
rc_status -v
startproc -f $MICASAD_BIN ;;
stop)
# Remember status and be verbose echo -n "Shutting miCASA daemon down"
rc_status -v #killproc -TERM $MICASAD_BIN
;; pid=`cat /var/run/micasad.pid`
stop) kill -s TERM $pid
echo -n "Shutting miCASA daemon down"
for file in "/etc/pam.d/login" "/etc/pam.d/sshd" "/etc/pam.d/xdm" "/etc/pam.d/gdm" "/etc/pam.d/kdm"
#killproc -TERM $MICASAD_BIN do
pid=`cat /var/run/micasad.pid` if [ -f $name ]
kill -s TERM $pid then
sed '/pam_micasa/d' $file > $file.sav
for file in "/etc/pam.d/login" "/etc/pam.d/sshd" "/etc/pam.d/xdm" "/etc/pam.d/gdm" "/etc/pam.d/kdm" mv $file.sav $file
do fi
if [ -f $name ] done
then # Remember status and be verbose
sed '/pam_micasa/d' $file > $file.sav rc_status -v
mv $file.sav $file ;;
fi restart)
done ## Stop the service and regardless of whether it was
## running or not, start it again.
# Remember status and be verbose echo -n "Restarting miCASA daemon"
rc_status -v $0 stop
;; $0 start
restart)
## Stop the service and regardless of whether it was # Remember status and be quiet
## running or not, start it again. rc_status
echo -n "Restarting miCASA daemon" ;;
$0 stop *)
$0 start echo "Usage: $0 {start|stop|restart}"
exit 1
# Remember status and be quiet ;;
rc_status esac
;; rc_exit
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
rc_exit