123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265 |
- XCOMM! /bin/ksh
- XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
- XCOMM @(#) $XConsortium: configMin.src /main/7 1996/04/23 10:35:44 drk $
- XCOMM AIX cpp does not honor the usual requirement that preprocessor
- XCOMM directives must begin in column one, so we must do more quoting.
- #define HASH #
- SERVICES=/etc/services
- INETD=/etc/inetd.conf
- AdddtspcToInetserv()
- {
- DTSPCD=CDE_INSTALLATION_TOP/bin/dtspcd
- XCOMM
- XCOMM check for existence of /etc/services
- XCOMM
- if [ ! -f $SERVICES ] # highly unlikely
- then
- echo "" >$SERVICES
- fi
- XCOMM
- XCOMM check for existence of /etc/inetd.conf
- XCOMM
- if [ ! -f $INETD ] # highly unlikely
- then
- echo "" >$INETD
- fi
- #ifdef _POWER
- /usr/sbin/chservices -a -v dtspc -p tcp -n 6112 1>/dev/null 2>/dev/null
- if [ $? -ne 0 ]
- then
- exit 1
- fi
- /usr/sbin/chsubserver -a -v dtspc -t stream -p tcp -w nowait -u root \
- -g $DTSPCD -r inetd $DTSPCD 1>/dev/null 2>/dev/null
- if [ $? -ne 0 ]
- then
- exit 1
- fi
- #else
- XCOMM
- XCOMM Check if the server exists in the /etc/services file.
- XCOMM
- rc=`inetserv -s -S -v dtspc -p tcp 1>/dev/null 2>/dev/null;echo $?`
-
- if [ "$rc" -ne "0" ]
- then
- XCOMM
- XCOMM Add entry into /etc/services file
- XCOMM
- inetserv -a -S -v dtspc -p tcp -n 6112
- fi
- XCOMM
- XCOMM Check if the server exists in the /etc/inetd.conf file.
- XCOMM
- rc=`inetserv -s -I -v dtspc -p tcp 1>/dev/null 2>/dev/null;echo $?`
- if [ "$rc" -ne "0" ]
- then
- inetserv -a -I -v dtspc -p tcp -t stream -w nowait -U root \
- -r $DTSPCD -R $DTSPCD 1>/dev/null 2>/dev/null
- fi
- XCOMM
- XCOMM remove legacy entries like "dtspcd" if exist
- XCOMM
- rc=`inetserv -s -S -v dtspcd -p tcp 1>/dev/null 2>/dev/null;echo $?`
- if [ "$rc" = "0" ]
- then
- inetserv -D -S -v dtspcd -p tcp
- fi
- #endif
- }
- CheckFordtspcService()
- {
- #ifdef _POWER
- rc=`grep "dtspc" $SERVICES | cut -c1 | grep -xv "#" \
- 1>/dev/null 2>/dev/null;echo $?`
- #else
- rc=`inetserv -s -S -v dtspc -p tcp 1>/dev/null 2>/dev/null;echo $?`
- #endif
- return $rc
- }
- RemovedtspcFromInetserv()
- {
- DTSPCD=CDE_INSTALLATION_TOP/bin/dtspcd
- #ifdef _POWER
- /usr/sbin/chservices -d -v dtspc -p tcp -n 6112 1>/dev/null 2>/dev/null
- if [ $? -ne 0 ]
- then
- exit 1
- fi
- /usr/sbin/chsubserver -d -v dtspc -t stream -p tcp -w nowait -u root \
- -g $DTSPCD -r inetd $DTSPCD 1>/dev/null 2>/dev/null
- if [ $? -ne 0 ]
- then
- exit 1
- fi
- #else
- XCOMM
- XCOMM Check if the server exists in the /etc/services file.
- XCOMM
- rc=`inetserv -s -S -v dtspc -p tcp 1>/dev/null 2>/dev/null;echo $?`
- if [ "$rc" = "0" ]
- then
- inetserv -D -S -v dtspc -p tcp 2>/dev/null 1>/dev/null
- fi
- XCOMM
- XCOMM remove legacy entries like "dtspcd" if exist
- XCOMM
- rc=`inetserv -s -S -v dtspcd -p tcp 1>/dev/null 2>/dev/null;echo $?`
- if [ "$rc" = "0" ]
- then
- inetserv -D -S -v dtspcd -p tcp
- fi
- #endif
- }
- StopDaemon()
- {
- ps -ef | fgrep $1 | grep -v grep >/tmp/tmppsout
- if [ -s /tmp/tmppsout ]
- then
- awk '{print "kill " $2}' /tmp/tmppsout | /bin/ksh 1>/dev/null
- sleep 2
- ps -ef | fgrep $1 | grep -v grep >/tmp/tmppsout
- if [ -s /tmp/tmppsout ]
- then
- awk '{print "kill -TERM " $2}' /tmp/tmppsout | /bin/ksh 1>/dev/null
- sleep 2
- ps -ef | fgrep $1 | grep -v grep >/tmp/tmppsout
- if [ -s /tmp/tmppsout ]
- then
- awk '{print "kill -9 " $2}' /tmp/tmppsout | /bin/ksh 1>/dev/null
- sleep 2
- fi
- fi
- fi
- rm -f /tmp/tmppsout
- }
- HandleOption()
- {
- while [ $# -ne 0 ]; do
- case $1 in
- -e) DO_CONFIGURATION="yes"
- shift;
- ;;
- -d) DO_CONFIGURATION="no"
- shift;
- ;;
- esac
- done
- }
- XCOMM #################################################################
- XCOMM
- XCOMM Main body
- XCOMM
- XCOMM #################################################################
- PRODUCT=CDE
- FILESET=CDE-MIN
- DO_CONFIGURATION=""
- retval=0
- #ifndef _POWER
- XCOMM
- XCOMM refresh the inetserv object class with the latest
- XCOMM entries from /etc/inetd.conf and /etc/services files
- XCOMM
- inetexp
- StopDaemon "dtspcd"
- #endif
- HandleOption $*
- if [ "$DO_CONFIGURATION" = "yes" ]
- then
- #ifndef _POWER
- XCOMM
- XCOMM create the /var/dt/tmp directory for the dtspcd
- XCOMM
- if [ ! -d CDE_LOGFILES_TOP/tmp ]
- then
- mkdir -p CDE_LOGFILES_TOP/tmp
- fi
- #endif
- CheckFordtspcService
- rc=$?
- if [ "$rc" -eq "0" ]
- then
- echo "\n dtspc is already enabled...\n"
- exit 0
- fi
- AdddtspcToInetserv
- #ifndef _POWER
- XCOMM
- XCOMM update inetd
- XCOMM
- inetimp
- refresh -s inetd
- #endif
- elif [ "$DO_CONFIGURATION" = "no" ]
- then
- CheckFordtspcService
- rc=$?
- if [ "$rc" = "0" ]
- then
- RemovedtspcFromInetserv
- else
- echo "\n dtspc is already disabled...\n"
- exit 0
- fi
- #ifndef _POWER
- XCOMM
- XCOMM update inetd
- XCOMM
- inetimp
- refresh -s inetd
- #endif
- fi
|