#! /bin/ksh # @(#)27 1.4.1.2 src/cde/admin/IntegTools/post_install/ibm/configMin.src, desktop, cde72V, v2020_34B7 8/20/20 20:04:42 # (c) Copyright 1993, 1994 International Business Machines Corp. SERVICES=/etc/services INETD=/etc/inetd.conf USRBIN=/usr/bin AdddtspcToInetserv() { DTSPCD=/usr/dt/bin/dtspcd # # check for existence of /etc/services # if [ ! -f $SERVICES ] # highly unlikely then echo "" >$SERVICES fi # # check for existence of /etc/inetd.conf # if [ ! -f $INETD ] # highly unlikely then echo "" >$INETD fi CheckFordtspcService rc=$? if [ "$rc" -ne "0" ] then /usr/sbin/chservices -a -v dtspcd -p tcp -n 6112 1>/dev/null 2>/dev/null if [ $? -ne 0 ] then exit 1 fi fi CheckFordtspcInetd rc=$? if [ "$rc" -ne "0" ] then /usr/sbin/chsubserver -a -v dtspcd -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 fi } CheckFordtspcService() { rc=`$USRBIN/grep "dtspcd" $SERVICES | $USRBIN/cut -c1 | $USRBIN/grep -xv "#" \ 1>/dev/null 2>/dev/null;echo $?` return $rc } CheckFordtspcInetd() { rc=`$USRBIN/grep "dtspcd" $INETD | $USRBIN/cut -c1 | $USRBIN/grep -xv "#" \ 1>/dev/null 2>/dev/null;echo $?` return $rc } RemovedtspcFromInetserv() { DTSPCD=/usr/dt/bin/dtspcd /usr/sbin/chservices -d -v dtspcd -p tcp -n 6112 1>/dev/null 2>/dev/null if [ $? -ne 0 ] then exit 1 fi /usr/sbin/chsubserver -d -v dtspcd -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 } StopDaemon() { $USRBIN/ps -ef | $USRBIN/fgrep $1 | $USRBIN/grep -v grep >/tmp/tmppsout if [ -s /tmp/tmppsout ] then $USRBIN/awk '{print "kill " $2}' /tmp/tmppsout | /bin/ksh 1>/dev/null $USRBIN/sleep 2 $USRBIN/ps -ef | $USRBIN/fgrep $1 | $USRBIN/grep -v grep >/tmp/tmppsout if [ -s /tmp/tmppsout ] then $USRBIN/awk '{print "kill -TERM " $2}' /tmp/tmppsout | /bin/ksh 1>/dev/null $USRBIN/sleep 2 $USRBIN/ps -ef | $USRBIN/fgrep $1 | $USRBIN/grep -v grep >/tmp/tmppsout if [ -s /tmp/tmppsout ] then $USRBIN/awk '{print "kill -9 " $2}' /tmp/tmppsout | /bin/ksh 1>/dev/null $USRBIN/sleep 2 fi fi fi $USRBIN/rm -f /tmp/tmppsout } HandleOption() { while [ $# -ne 0 ]; do case $1 in -e) DO_CONFIGURATION="yes" shift; ;; -d) DO_CONFIGURATION="no" shift; ;; esac done } ################################################################## # # Main body # ################################################################## PRODUCT=CDE FILESET=CDE-MIN DO_CONFIGURATION="" retval=0 HandleOption $* if [ "$DO_CONFIGURATION" = "yes" ] then CheckFordtspcInetd rc=$? if [ "$rc" -eq "0" ] then CheckFordtspcService rc=$? if [ "$rc" -eq "0" ] then echo "\n dtspcd is already enabled...\n" exit 0 fi fi AdddtspcToInetserv elif [ "$DO_CONFIGURATION" = "no" ] then CheckFordtspcInetd rc=$? if [ "$rc" = "0" ] then RemovedtspcFromInetserv else echo "\n dtspcd is already disabled...\n" exit 0 fi fi