configMin.src 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. XCOMM! /bin/ksh
  2. XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
  3. XCOMM @(#) $XConsortium: configMin.src /main/7 1996/04/23 10:35:44 drk $
  4. XCOMM AIX cpp does not honor the usual requirement that preprocessor
  5. XCOMM directives must begin in column one, so we must do more quoting.
  6. #define HASH #
  7. SERVICES=/etc/services
  8. INETD=/etc/inetd.conf
  9. AdddtspcToInetserv()
  10. {
  11. DTSPCD=CDE_INSTALLATION_TOP/bin/dtspcd
  12. XCOMM
  13. XCOMM check for existence of /etc/services
  14. XCOMM
  15. if [ ! -f $SERVICES ] # highly unlikely
  16. then
  17. echo "" >$SERVICES
  18. fi
  19. XCOMM
  20. XCOMM check for existence of /etc/inetd.conf
  21. XCOMM
  22. if [ ! -f $INETD ] # highly unlikely
  23. then
  24. echo "" >$INETD
  25. fi
  26. #ifdef _POWER
  27. /usr/sbin/chservices -a -v dtspc -p tcp -n 6112 1>/dev/null 2>/dev/null
  28. if [ $? -ne 0 ]
  29. then
  30. exit 1
  31. fi
  32. /usr/sbin/chsubserver -a -v dtspc -t stream -p tcp -w nowait -u root \
  33. -g $DTSPCD -r inetd $DTSPCD 1>/dev/null 2>/dev/null
  34. if [ $? -ne 0 ]
  35. then
  36. exit 1
  37. fi
  38. #else
  39. XCOMM
  40. XCOMM Check if the server exists in the /etc/services file.
  41. XCOMM
  42. rc=`inetserv -s -S -v dtspc -p tcp 1>/dev/null 2>/dev/null;echo $?`
  43. if [ "$rc" -ne "0" ]
  44. then
  45. XCOMM
  46. XCOMM Add entry into /etc/services file
  47. XCOMM
  48. inetserv -a -S -v dtspc -p tcp -n 6112
  49. fi
  50. XCOMM
  51. XCOMM Check if the server exists in the /etc/inetd.conf file.
  52. XCOMM
  53. rc=`inetserv -s -I -v dtspc -p tcp 1>/dev/null 2>/dev/null;echo $?`
  54. if [ "$rc" -ne "0" ]
  55. then
  56. inetserv -a -I -v dtspc -p tcp -t stream -w nowait -U root \
  57. -r $DTSPCD -R $DTSPCD 1>/dev/null 2>/dev/null
  58. fi
  59. XCOMM
  60. XCOMM remove legacy entries like "dtspcd" if exist
  61. XCOMM
  62. rc=`inetserv -s -S -v dtspcd -p tcp 1>/dev/null 2>/dev/null;echo $?`
  63. if [ "$rc" = "0" ]
  64. then
  65. inetserv -D -S -v dtspcd -p tcp
  66. fi
  67. #endif
  68. }
  69. CheckFordtspcService()
  70. {
  71. #ifdef _POWER
  72. rc=`grep "dtspc" $SERVICES | cut -c1 | grep -xv "#" \
  73. 1>/dev/null 2>/dev/null;echo $?`
  74. #else
  75. rc=`inetserv -s -S -v dtspc -p tcp 1>/dev/null 2>/dev/null;echo $?`
  76. #endif
  77. return $rc
  78. }
  79. RemovedtspcFromInetserv()
  80. {
  81. DTSPCD=CDE_INSTALLATION_TOP/bin/dtspcd
  82. #ifdef _POWER
  83. /usr/sbin/chservices -d -v dtspc -p tcp -n 6112 1>/dev/null 2>/dev/null
  84. if [ $? -ne 0 ]
  85. then
  86. exit 1
  87. fi
  88. /usr/sbin/chsubserver -d -v dtspc -t stream -p tcp -w nowait -u root \
  89. -g $DTSPCD -r inetd $DTSPCD 1>/dev/null 2>/dev/null
  90. if [ $? -ne 0 ]
  91. then
  92. exit 1
  93. fi
  94. #else
  95. XCOMM
  96. XCOMM Check if the server exists in the /etc/services file.
  97. XCOMM
  98. rc=`inetserv -s -S -v dtspc -p tcp 1>/dev/null 2>/dev/null;echo $?`
  99. if [ "$rc" = "0" ]
  100. then
  101. inetserv -D -S -v dtspc -p tcp 2>/dev/null 1>/dev/null
  102. fi
  103. XCOMM
  104. XCOMM remove legacy entries like "dtspcd" if exist
  105. XCOMM
  106. rc=`inetserv -s -S -v dtspcd -p tcp 1>/dev/null 2>/dev/null;echo $?`
  107. if [ "$rc" = "0" ]
  108. then
  109. inetserv -D -S -v dtspcd -p tcp
  110. fi
  111. #endif
  112. }
  113. StopDaemon()
  114. {
  115. ps -ef | fgrep $1 | grep -v grep >/tmp/tmppsout
  116. if [ -s /tmp/tmppsout ]
  117. then
  118. awk '{print "kill " $2}' /tmp/tmppsout | /bin/ksh 1>/dev/null
  119. sleep 2
  120. ps -ef | fgrep $1 | grep -v grep >/tmp/tmppsout
  121. if [ -s /tmp/tmppsout ]
  122. then
  123. awk '{print "kill -TERM " $2}' /tmp/tmppsout | /bin/ksh 1>/dev/null
  124. sleep 2
  125. ps -ef | fgrep $1 | grep -v grep >/tmp/tmppsout
  126. if [ -s /tmp/tmppsout ]
  127. then
  128. awk '{print "kill -9 " $2}' /tmp/tmppsout | /bin/ksh 1>/dev/null
  129. sleep 2
  130. fi
  131. fi
  132. fi
  133. rm -f /tmp/tmppsout
  134. }
  135. HandleOption()
  136. {
  137. while [ $# -ne 0 ]; do
  138. case $1 in
  139. -e) DO_CONFIGURATION="yes"
  140. shift;
  141. ;;
  142. -d) DO_CONFIGURATION="no"
  143. shift;
  144. ;;
  145. esac
  146. done
  147. }
  148. XCOMM #################################################################
  149. XCOMM
  150. XCOMM Main body
  151. XCOMM
  152. XCOMM #################################################################
  153. PRODUCT=CDE
  154. FILESET=CDE-MIN
  155. DO_CONFIGURATION=""
  156. retval=0
  157. #ifndef _POWER
  158. XCOMM
  159. XCOMM refresh the inetserv object class with the latest
  160. XCOMM entries from /etc/inetd.conf and /etc/services files
  161. XCOMM
  162. inetexp
  163. StopDaemon "dtspcd"
  164. #endif
  165. HandleOption $*
  166. if [ "$DO_CONFIGURATION" = "yes" ]
  167. then
  168. #ifndef _POWER
  169. XCOMM
  170. XCOMM create the /var/dt/tmp directory for the dtspcd
  171. XCOMM
  172. if [ ! -d CDE_LOGFILES_TOP/tmp ]
  173. then
  174. mkdir -p CDE_LOGFILES_TOP/tmp
  175. fi
  176. #endif
  177. CheckFordtspcService
  178. rc=$?
  179. if [ "$rc" -eq "0" ]
  180. then
  181. echo "\n dtspc is already enabled...\n"
  182. exit 0
  183. fi
  184. AdddtspcToInetserv
  185. #ifndef _POWER
  186. XCOMM
  187. XCOMM update inetd
  188. XCOMM
  189. inetimp
  190. refresh -s inetd
  191. #endif
  192. elif [ "$DO_CONFIGURATION" = "no" ]
  193. then
  194. CheckFordtspcService
  195. rc=$?
  196. if [ "$rc" = "0" ]
  197. then
  198. RemovedtspcFromInetserv
  199. else
  200. echo "\n dtspc is already disabled...\n"
  201. exit 0
  202. fi
  203. #ifndef _POWER
  204. XCOMM
  205. XCOMM update inetd
  206. XCOMM
  207. inetimp
  208. refresh -s inetd
  209. #endif
  210. fi