New functions.ksh
1 #
2 # CDDL HEADER START
3 #
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the License).
6 # You may not use this file except in compliance with the License.
7 #
8 # You can obtain a copy of the license at usr/src/CDDL.txt
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
12 #
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/CDDL.txt.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets [] replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 #
19 # CDDL HEADER END
20 #
21 # Copyright 2008 Sun Microsystems, Inc. All rights reserved.
22 # Use is subject to license terms.
23 #
24 #ident "@(#)functions.ksh 1.5 08/05/27 SMI"
25 #
26
27 PKG=SUNWscids
28 LOGFILE=/var/tmp/${RESOURCE}_logfile
29 TASK_COMMAND=""
30 RESOURCE_PROJECT_NAME=""
31 SCLOGGER=/usr/cluster/lib/sc/scds_syslog
32 LOGGER=/usr/bin/logger
33
34 syslog_tag()
35 {
36 ${SET_DEBUG}
37 print "SC[${PKG:-??}.${COMPONENT:-??}.${METHOD:-??}]:${RESOURCEGROUP:-??}:${RESOURCE:-??}"
38 }
39
40 scds_syslog()
41 {
42 if [ -f "${SCLOGGER}" ]
43 then
44 ${SCLOGGER} "$@" &
45 else
46 while getopts 'p:t:m' opt
47 do
48 case "${opt}" in
49 t) TAG=${OPTARG};;
50 p) PRI=${OPTARG};;
51 esac
52 done
53
54 shift $((${OPTIND} - 1))
55 LOG_STRING=$(/usr/bin/printf "$@")
56 ${LOGGER} -p ${PRI} -t ${TAG} ${LOG_STRING}
57 fi
58 }
59
60 debug_message()
61 {
62 if [ "${DEBUG}" = "${RESOURCE}" -o "${DEBUG}" = "ALL" ]
63 then
64 SET_DEBUG="set -x"
65 DEBUG_TEXT=${1}
66
67 scds_syslog -p daemon.debug -t $(syslog_tag) -m \
68 "%s" "${DEBUG_TEXT}"
69 else
70 SET_DEBUG=
71 fi
72 }
73
74 log_message()
75 {
76 debug_message "Function: log_message - Begin"
77 ${SET_DEBUG}
78
79 if [ -s "${LOGFILE}" ]
80 then
81 PRIORITY=$1
82 HEADER=$2
83
84 strings ${LOGFILE} > ${LOGFILE}.copy
85
86 while read MSG_TXT
87 do
88 scds_syslog -p daemon.${PRIORITY} -t $(syslog_tag) -m \
89 "%s - %s" \
90 "${HEADER}" "${MSG_TXT}"
91 done < ${LOGFILE}.copy
92
93 cat /dev/null > ${LOGFILE}
94 fi
95
96 debug_message "Function: log_message - End"
97 }
98
99 set_redirection()
100 {
101 debug_message "Function: set_redirection - Begin"
102 ${SET_DEBUG}
103
104 if /usr/bin/getent passwd ${USERID} | /usr/bin/awk -F: '{print $7}' | /usr/bin/grep csh > /dev/null
105 then
106 OUTPUT=">& ${LOGFILE}"
107 else
108 OUTPUT="> ${LOGFILE} 2>&1"
109 fi
110
111 debug_message "Function: set_redirection - End"
112 }
113
114 validate()
115 {
116 debug_message "Function: validate - Begin"
117 ${SET_DEBUG}
118
119 rc=0
120
121 # Note that group/user informix is an IDS requirement. Refer to
122 # http://publib.boulder.ibm.com/infocenter/idshelp/v111/index.jsp?topic
123 # and in particular Installing IDS.
124
125 if /usr/bin/getent passwd informix > /dev/null
126 then
127 debug_message "Validate - User informix exists"
128 else
129 # SCMSGS
130 # @explanation
131 # The userid informix does not exist.
132 # @user_action
133 # You must create the userid informix.
134 scds_syslog -p daemon.error -t $(syslog_tag) -m \
135 "Validate - User informix does not exist"
136 rc=1
137 fi
138
139 if /usr/bin/getent group informix > /dev/null
140 then
141 debug_message "Validate - Group informix exists"
142 else
143 # SCMSGS
144 # @explanation
145 # The group informix does not exist.
146 # @user_action
147 # You must create the group informix.
148 scds_syslog -p daemon.error -t $(syslog_tag) -m \
149 "Validate - Group informix does not exist"
150 rc=1
151 fi
152
153 if [ "${USERID}" = "informix" ]
154 then
155 debug_message "Validate - Userid is informix"
156 else
157 pgroup=$(/usr/bin/getent passwd ${USERID} | /usr/bin/awk -F: '{print $4}')
158
159 if [ -n "${pgroup}" ]
160 then
161 if /usr/bin/getent group ${pgroup} | /usr/bin/awk -F: '{ if ($1 == "informix") print $3}' | \
162 /usr/bin/grep "^${pgroup}$" > /dev/null
163 then
164 debug_message "Validate - Primary group for userid ${USERID} is informix"
165 else
166 if /usr/bin/getent group informix | /usr/bin/awk -F: '{print $4}' | \
167 /usr/bin/grep ${USERID} > /dev/null
168 then
169 debug_message "Validate - Secondary group for userid ${USERID} is informix"
170 else
171 # SCMSGS
172 # @explanation
173 # The user is not a member of the group informix.
174 # @user_action
175 # Ensure the user is a member of the group informix.
176 scds_syslog -p daemon.error -t $(syslog_tag) -m \
177 "Validate - Userid %s is not a member of group informix" \
178 "${USERID}"
179 rc=1
180 fi
181 fi
182 else
183 # SCMSGS
184 # @explanation
185 # The user is not a valid userid.
186 # @user_action
187 # Ensure the user name is correct.
188 scds_syslog -p daemon.error -t $(syslog_tag) -m \
189 "Validate - User %s is not a valid userid" \
190 "${USERID}"
191 rc=1
192 fi
193 fi
194
195 if [ -d "${INFORMIXDIR}" ]
196 then
197 debug_message "Validate - ${INFORMIXDIR} exists"
198
199 if [ -x "${INFORMIXDIR}/bin/oninit" ]
200 then
201 debug_message "Validate - ${INFORMIXDIR}/bin/oninit exists and is executable"
202 else
203 # SCMSGS
204 # @explanation
205 # oninit was not found in ${INFORMIXDIR}/bin.
206 # @user_action
207 # Ensure that ${INFORMIXDIR} is the directory path
208 # where the Informix files are installed.
209 scds_syslog -p daemon.error -t $(syslog_tag) -m \
210 "Validate - %s/bin/oninit does not exist" \
211 "${INFORMIXDIR}"
212 rc=1
213 fi
214 else
215 # SCMSGS
216 # @explanation
217 # ${INFORMIXDIR} does not exist or is not a directory.
218 # @user_action
219 # Ensure that ${INFORMIXDIR} is the directory path
220 # where the Informix files are installed.
221 scds_syslog -p daemon.error -t $(syslog_tag) -m \
222 "Validate - %s does not exist or is not a directory" \
223 "${INFORMIXDIR}"
224 rc=1
225 fi
226
227 # Here, we check that the ${ONCONFIG} file contains
228 # the ROOTNAME variable, below is snipped sample
229 # ${ONCONFIG} file containing ROOTNAME.
230 #
231 # ROOTNAME rootdbs # Root dbspace name
232
233 if [ -f "${INFORMIXDIR}/etc/${ONCONFIG}" ]
234 then
235 debug_message "Validate - ${INFORMIXDIR}/etc/${ONCONFIG} exists"
236
237 if /usr/xpg4/bin/grep -qw ROOTNAME ${INFORMIXDIR}/etc/${ONCONFIG}
238 then
239 debug_message "Validate - ROOTNAME found in ${INFORMIXDIR}/etc/${ONCONFIG}"
240 else
241 # SCMSGS
242 # @explanation
243 # ${INFORMIXDIR}/bin/${ONCONFIG} is not a valid onconfig file.
244 # @user_action
245 # Ensure that ${INFORMIXDIR}/etc/${ONCONFIG} is a valid onconfig file.
246 scds_syslog -p daemon.error -t $(syslog_tag) -m \
247 "Validate - %s/bin/%s is not a valid onconfig file" \
248 "${INFORMIXDIR}" "${ONCONFIG}"
249 rc=1
250 fi
251
252 # Here, we check that the ${ONCONFIG} file contains
253 # the ${INFORMIXSERVER} name, below is snipped sample
254 # ${ONCONFIG} file containing ${INFORMIXSERVER}.
255 #
256 # DBSERVERNAME demo_on
257 #
258 # Note that ${INFORMIXSERVER} is represented by "demo_on".
259
260 if /usr/xpg4/bin/grep -qw ${INFORMIXSERVER} ${INFORMIXDIR}/etc/${ONCONFIG}
261 then
262 debug_message "Validate - ${INFORMIXSERVER} found in ${INFORMIXDIR}/etc/${ONCONFIG}"
263 else
264 # SCMSGS
265 # @explanation
266 # ${INFORMIXDIR}/etc/${ONCONFIG} does not contain ${INFORMIXSERVER}.
267 # @user_action
268 # Ensure that ${INFORMIXDIR}/etc/${ONCONFIG} contains ${INFORMIXSERVER}.
269 scds_syslog -p daemon.error -t $(syslog_tag) -m \
270 "Validate - %s/etc/%s does not contain %s" \
271 "${INFORMIXDIR}" "${ONCONFIG}" "${INFORMIXSERVER}"
272 rc=1
273 fi
274 else
275 # SCMSGS
276 # @explanation
277 # ${INFORMIXDIR}/etc/${ONCONFIG} does not exist.
278 # @user_action
279 # Ensure that ${INFORMIXDIR}/etc/${ONCONFIG} exists.
280 scds_syslog -p daemon.error -t $(syslog_tag) -m \
281 "Validate - %s/etc/%s does not exist" \
282 "${INFORMIXDIR}" "${ONCONFIG}"
283 rc=1
284 fi
285
286 # Here, we check that the ${INFORMIXSQLHOSTS} file contains
287 # the ${INFORMIXSERVER} name, below is snipped sample
288 # ${INFORMIXSQLHOSTS} file containing ${INFORMIXSERVER}.
289 #
290 # demo_on ontlitcp lzmutt1a 9088
291 #
292 # Note that ${INFORMIXSERVER} is represented by "demo_on".
293
294 if [ -f "${INFORMIXSQLHOSTS}" ]
295 then
296 debug_message "Validate - ${INFORMIXSQLHOSTS} exists"
297
298 if /usr/xpg4/bin/grep -qw ${INFORMIXSERVER} ${INFORMIXSQLHOSTS}
299 then
300 debug_message "Validate - ${INFORMIXSERVER} found in ${INFORMIXSQLHOSTS}"
301 else
302 # SCMSGS
303 # @explanation
304 # ${INFORMIXSQLHOSTS} does not contain ${INFORMIXSERVER}.
305 # @user_action
306 # Ensure that ${INFORMIXSQLHOSTS} is contains ${INFORMIXSERVER}.
307 scds_syslog -p daemon.error -t $(syslog_tag) -m \
308 "Validate - %s does not contain %s" \
309 "${INFORMIXSQLHOSTS}" "${INFORMIXSERVER}"
310 rc=1
311 fi
312 else
313 # SCMSGS
314 # @explanation
315 # ${INFORMIXSQLHOSTS does not exist.
316 # @user_action
317 # Ensure that ${INFORMIXSQLHOSTS} exists.
318 scds_syslog -p daemon.error -t $(syslog_tag) -m \
319 "Validate - %s does not exist" \
320 "${INFORMIXSQLHOSTS}"
321 rc=1
322 fi
323
324 if [ "${rc}" -eq 0 ]
325 then
326 # SCMSGS
327 # @explanation
328 # The Informix Server validation was successful.
329 # @user_action
330 # None required, informational message.
331 scds_syslog -p daemon.info -t $(syslog_tag) -m \
332 "Validate - Informix Server (%s) validation was successful" \
333 "${INFORMIXSERVER}"
334 fi
335
336 debug_message "Function: validate - End"
337 return ${rc}
338 }
339
340 start_ids()
341 {
342 debug_message "Function: start_ids - Begin"
343 ${SET_DEBUG}
344
345 /usr/bin/rm ${LOGFILE} 2> /dev/null
346
347 get_state
348 check_ids debug
349 rc=$?
350
351 # Check_ids will return 0 if
352 # - The Informix Server is running
353 # - No blocked on "MEDIA FAILURE" or "HANG_SYSTEM" exists
354
355 if [ "${rc}" -eq 0 ]
356 then
357 # Turn off PMF restart if ${INFORMIXSERVER} has been manually started
358 /usr/bin/sleep ${START_TIMEOUT} &
359 /usr/cluster/bin/pmfadm -s ${RESOURCEGROUP},${RESOURCE},0.svc
360
361 # SCMSGS
362 # @explanation
363 # The specified Informix Server has been manually started.
364 # @user_action
365 # None required. Informational message.
366 scds_syslog -p daemon.notice -t $(syslog_tag) -m \
367 "start_ids - Informix Server (%s) was manually started" \
368 "${INFORMIXSERVER}"
369
370 return 0
371 fi
372
373 /usr/bin/su ${USERID} -c "${TASK_COMMAND} /usr/bin/env INFORMIXDIR=${INFORMIXDIR} INFORMIXSERVER=${INFORMIXSERVER} INFORMIXSQLHOSTS=${INFORMIXSQLHOSTS} ONCONFIG=${ONCONFIG} ${INFORMIXDIR}/bin/oninit -y ${OUTPUT} &" > /dev/null
374
375 rc=$?
376
377 if [ "${rc}" -eq 0 ]
378 then
379 # SCMSGS
380 # @explanation
381 # The specified Informix Server was started successfully.
382 # @user_action
383 # None required. Informational message.
384 scds_syslog -p daemon.info -t $(syslog_tag) -m \
385 "start_ids - Informix Server (%s) started rc(%s)" \
386 "${INFORMIXSERVER}" "${rc}"
387 else
388 # SCMSGS
389 # @explanation
390 # The specified Informix Server failed to start.
391 # @user_action
392 # Check the syslog for further messages. If possible the
393 # Solaris Cluster will attempt to restart the Informix
394 # Server.
395 scds_syslog -p daemon.error -t $(syslog_tag) -m \
396 "start_ids - Informix Server (%s) failed to start rc(%s)" \
397 "${INFORMIXSERVER}" "${rc}"
398
399 log_message error "start_ids rc(${rc})"
400 fi
401
402 debug_message "Function: start_ids - End"
403 return ${rc}
404 }
405
406 check_start()
407 {
408 debug_message "Function: check_start - Begin"
409 ${SET_DEBUG}
410
411 if [ -x /sbin/zonename ]
412 then
413 /usr/bin/pgrep -z ${ZONENAME} -f "$1 .*-R ${RESOURCE} " >/dev/null 2>&1
414 else
415 /usr/bin/pgrep -u root -f "$1 .*-R ${RESOURCE} " >/dev/null 2>&1
416 fi
417
418 rc=$?
419
420 debug_message "Function: check_start - End"
421 return ${rc}
422 }
423
424 get_state()
425 {
426 debug_message "Function: get_state - Begin"
427 ${SET_DEBUG}
428
429 # The Informix Dynamic Server has an operating mode which can be obtained
430 # by using the "onstat -" utility that prints the output header of the
431 # onstat utility. The format of the output header is as follows,
432 #
433 # Version--Mode (Type)--(Checkpnt)--Up Uptime--Sh_mem Kbytes
434 #
435 # "Version" will contain the product name and version number.
436 # "Mode" will contain the currrent operating mode.
437 #
438 # In addition to the operating mode, the database maybe blocked from
439 # performing any work. If the database is blocked, the blocked reason
440 # is also displayed in the onstat output header.
441 #
442 # Of interest to us is "Version", "Mode" and any blocked reason.
443 #
444 # Under normal operation the product name within "Version" will contain
445 # "IBM Informix Dynamic Server", after which "Mode" will reflect an
446 # appropriate operating mode. Blocked states only appear once a "Mode"
447 # is reached.
448 #
449 # The following shows two sample "onstat -" outputs,
450 # Before IDS is started.
451 #
452 # shared memory not initialized for INFORMIXSERVER 'demo_on'
453 #
454 # After IDS is started.
455 #
456 # IBM Informix Dynamic Server Version 11.10.FC1 -- On-Line -- Up 01:47:59 -- 29696 Kbytes
457
458 onstat_header=$(/usr/bin/su ${USERID} -c "${TASK_COMMAND} /usr/bin/env INFORMIXDIR=${INFORMIXDIR} INFORMIXSERVER=${INFORMIXSERVER} INFORMIXSQLHOSTS=${INFORMIXSQLHOSTS} ONCONFIG=${ONCONFIG} ${INFORMIXDIR}/bin/onstat - | /usr/bin/grep .")
459
460 if echo ${onstat_header} | /usr/xpg4/bin/grep -q "Informix Dynamic Server"
461 then
462 onstat_mode=$(echo ${onstat_header} | /usr/bin/sed -e 's/ -- Up.*$//' -e 's/^.*-- //')
463
464 if echo ${onstat_header} | /usr/xpg4/bin/grep -q "Blocked:"
465 then
466 onstat_blocked=$(echo ${onstat_header} | /usr/bin/sed -e 's/^.*Blocked://')
467 else
468 onstat_blocked=""
469 fi
470 fi
471
472 debug_message "Function: get_state - End"
473 }
474
475 check_ids()
476 {
477 debug_message "Function: check_ids - Begin"
478 ${SET_DEBUG}
479
480 LEVEL=error
481 [ "$1" = "debug" ] && LEVEL=debug
482
483 # Check if IDS is starting up.
484 if echo ${onstat_header} | /usr/xpg4/bin/grep -q "Changing data structure"
485 then
486 # SCMSGS
487 # @explanation
488 # The Informix Server database is starting up.
489 # @user_action
490 # None required. Solaris Cluster will restart the Informix Server
491 # so that it is managed by Solaris Cluster.
492 scds_syslog -p daemon.${LEVEL} -t $(syslog_tag) -m \
493 "check_ids - Database Instance %s is restarting" \
494 "${INFORMIXSERVER}"
495
496 return 100
497 fi
498
499 # Check if IDS is down.
500 if echo ${onstat_header} | /usr/xpg4/bin/grep -q -E "shared memory not initialized|WARNING: IBM Informix Dynamic Server is no longer running"
501 then
502 # SCMSGS
503 # @explanation
504 # The Informix Server database is down.
505 # @user_action
506 # None required. Solaris Cluster will restart the Informix Server.
507 scds_syslog -p daemon.${LEVEL} -t $(syslog_tag) -m \
508 "check_ids - Database Instance %s is down" \
509 "${INFORMIXSERVER}"
510
511 return 100
512 fi
513
514 # Check for any blocked states.
515 # Regardless of the onstat_mode, if a blocked state of "MEDIA FAILURE" or
516 # "HANG_SYSTEM" exists we will register a complete failure and indicate
517 # that the DBA needs to be involved.
518
519 if [ -n "${onstat_blocked}" ]
520 then
521 if echo "${onstat_blocked}" | /usr/xpg4/bin/grep -q -E "MEDIA_FAILURE|HANG_SYSTEM"
522 then
523 # SCMSGS
524 # @explanation
525 # The Informix Dynamic Server database has failed.
526 # @user_action
527 # Check the system log for error messages and contact your DBA.
528 # Solaris Cluster will restart the Informix Server.
529 scds_syslog -p daemon.${LEVEL} -t $(syslog_tag) -m \
530 "check_ids - Database Instance %s has failed mode(%s) blocked(%s), contact your DBA" \
531 "${INFORMIXSERVER}" "${onstat_mode}" "${onstat_blocked}"
532
533 return 100
534 fi
535 fi
536
537 case "${onstat_mode}" in
538 # Maintenance & Startup modes
539 "Quiescent"|"Administration"|"Single User"|"Initialization"|"Fast Recovery"|"Recovery")
540
541 rc=100
542 ;;
543
544 # The following IDS server modes are acceptable normal operation modes.
545
546 "On-Line"|"Read-only") # Normal operation modes
547
548 rc=0
549 ;;
550
551 # Any other IDS server modes are treated as a complete failure.
552
553 *) # Unknown modes
554 rc=100
555 ;;
556 esac
557
558 debug_message "check_ids - ${onstat_header}"
559
560 if [ "${LEVEL}" != "debug" ]
561 then
562 # While we tolerate some blocked states we will output a status message
563 # to Solaris Cluster if one is found. Nevertheless the resource remains online.
564
565 saved_rc=${rc}
566
567 # Check if GDS is still starting the resource. If GDS start has finished we'll set
568 # the Solaris Cluster resource status with the appropriate Mode and any Blocked state.
569
570 if ! check_start gds_svc_start
571 then
572 MESSAGE=
573 [ -n "${onstat_mode}" ] && MESSAGE="Mode:${onstat_mode}"
574 [ -n "${onstat_blocked}" ] && MESSAGE="${MESSAGE} Blocked:${onstat_blocked}"
575
576 /usr/cluster/bin/scha_resource_setstatus -R ${RESOURCE} -G ${RESOURCEGROUP} -s OK -m "${MESSAGE}"
577 fi
578
579 rc=${saved_rc}
580
581 fi
582
583 debug_message "Function: check_ids - End"
584 return ${rc}
585 }
586
587 stop_ids()
588 {
589 debug_message "Function: stop_ids - Begin"
590 ${SET_DEBUG}
591
592 MAX_STOP_TIMEOUT=$(/usr/bin/expr ${STOP_TIMEOUT} \* 70 \/ 100)
593 SECONDS=0
594
595 /usr/bin/su ${USERID} -c "${TASK_COMMAND} /usr/bin/env INFORMIXDIR=${INFORMIXDIR} INFORMIXSERVER=${INFORMIXSERVER} INFORMIXSQLHOSTS=${INFORMIXSQLHOSTS} ONCONFIG=${ONCONFIG} ${INFORMIXDIR}/bin/onmode -uky ${OUTPUT} &" > /dev/null
596
597 while [ "${SECONDS}" -lt "${MAX_STOP_TIMEOUT}" ]
598 do
599 get_state
600
601 if echo ${onstat_header} | /usr/xpg4/bin/grep -q "shared memory not initialized"
602 then
603 SECONDS=${MAX_STOP_TIMEOUT}
604 else
605 sleep 5
606 fi
607 done
608
609 # Note that the shutdown will be run in the background. As such the contents
610 # of ${LOGFILE} is not of interest so we will clear that file.
611
612 cat /dev/null > ${LOGFILE}
613
614 get_state
615
616 if ! echo ${onstat_header} | /usr/xpg4/bin/grep -q "shared memory not initialized"
617 then
618 /usr/cluster/bin/pmfadm -s ${RESOURCEGROUP},${RESOURCE},0.svc KILL 2> /dev/null
619 fi
620
621 debug_message "Function: stop_ids - End"
622 return 0
623 }
624
625 cleanup_ipc()
626 {
627 debug_message "Function: cleanup_ipc - Begin"
628 ${SET_DEBUG}
629
630 # Cleanup any IPC shared memory segments however only if
631 #
632 # - The shared memory segment(s) are owned by
633 # OWNER=root and GROUP=informix
634 # - The shared memory has no attached processes
635 # - The CPID and LPID processes are not running
636
637 flag=
638
639 if [ "${DEBUG}" = "${RESOURCE}" -o "${DEBUG}" = "ALL" ]
640 then
641 debug_message "IPC Status BEFORE removal of non-attached segments created by group informix"
642 /usr/bin/ipcs -mcopbZ | /usr/bin/grep " ${ZONENAME}$" > ${LOGFILE}
643 log_message debug ipcs
644 fi
645
646 /usr/bin/ipcs -mcopbZ | /usr/bin/grep " ${ZONENAME}$" | /usr/bin/awk ' \
647 {if (NF == 13 && $5 == "root" && $6 == "informix" && $9 == 0 ) print $2,$11,$12; else \
648 if (NF == 12 && $4 == "root" && $5 == "informix" && $8 == 0 ) print $1,$10,$11 }' | \
649 while read SHMID CPID LPID
650 do
651 if /usr/bin/ps -p ${LPID} -o zone | /usr/bin/grep " ${ZONENAME}$" > /dev/null
652 then
653 debug_message "Informix SHMID: ${SHMID} - LPID ${LPID} is running"
654 else
655 if /usr/bin/ps -p ${CPID} -o zone | /usr/bin/grep " ${ZONENAME}$" > /dev/null
656 then
657 debug_message "Informix SHMID: ${SHMID} - CPID ${CPID} is running"
658 else
659 SHMID=$(/usr/bin/echo ${SHMID} | /usr/xpg4/bin/tr 'm' ' ')
660
661 # As the initial ipcs -mcopbZ is only a snapshot in time, Informix
662 # may have already cleaned up. Therefore the following attempt to remove a
663 # shared memory segment may fail with "not found". To prevent misleading
664 # console messages stdout/stderr is redirected to /dev/null.
665
666 /usr/bin/ipcrm -z ${ZONENAME} -m ${SHMID} > /dev/null 2>&1
667
668 debug_message "Informix SHMID: ${SHMID} - removed"
669
670 flag=deleted
671 fi
672 fi
673 done
674
675 if [ -n "${flag}" ]
676 then
677 # SCMSGS
678 # @explanation
679 # All the Informix shared memory segments that were not being
680 # used have been removed.
681 # @user_action
682 # None required. Informational message.
683 scds_syslog -p daemon.notice -t $(syslog_tag) -m \
684 "All Informix non-attached IPC shared memory segments removed"
685 fi
686
687 debug_message "IPC Status AFTER removal of non-attached segments created by group informix"
688
689 if [ "${DEBUG}" = "${RESOURCE}" -o "${DEBUG}" = "ALL" ]
690 then
691 /usr/bin/ipcs -mcopbZ | /usr/bin/grep " ${ZONENAME}$" > ${LOGFILE}
692 log_message debug ipcs
693 fi
694
695 debug_message "Function: cleanup_ipc - End"
696 return 0
697 }