File: gtmstop.gtc

package info (click to toggle)
fis-gtm 7.1-006-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 32,908 kB
  • sloc: ansic: 344,906; asm: 5,184; csh: 4,859; sh: 2,000; awk: 294; makefile: 73; sed: 13
file content (85 lines) | stat: -rwxr-xr-x 2,630 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh
#################################################################
#								#
# Copyright (c) 2001-2019 Fidelity National Information		#
# Services, Inc. and/or its subsidiaries. All rights reserved.	#
#								#
#	This source code contains the intellectual property	#
#	of its copyright holder(s), and is made available	#
#	under a license.  If you do not know the terms of	#
#	the license, please stop and do not read further.	#
#								#
#################################################################
gtm_dist=GTMDIST
echo=ECHO
arch=ARCH
tmpfile="/tmp/tmp$$"

if [ "`whoami`" != "root" ] ; then
$echo "If you want to perform a rundown on anyone"
$echo "else's MUMPS process, you must run this program as root."
$echo \\n
fi

$echo "Signalling all MUMPS processes to proceed with rundown."
$echo \\n

ps -ef | grep mumps | grep -v grep | awk '{ print "kill -15", $2, " ; sleep 1" }' | sh > /dev/null 2>&1

$echo "Waiting for MUMPS processes to rundown."
$echo \\n

sleep 10

$echo "Resignalling processes."
$echo \\n

ps -ef | grep mumps | grep -v grep | awk '{ print "kill -15", $2, " ; sleep 1" }' | sh > /dev/null 2>&1

ps -ef | fgrep mumps | fgrep -v grep > $tmpfile
if [ $? -eq 0 ]
then
	$echo "The following mumps process(es) are still running:"
	cat $tmpfile
fi
rm -f $tmpfile

if [ "`whoami`" != "root" ] ; then
	$echo "You are not root. Unable to terminate some GT.M processes"
else
	$echo "Do you want to stop GT.M server(s) if present? (y or n)\c"
	read resp
	if [ "$resp" = "Y" -o "$resp" = "y" ] ; then
		$echo \\n

		if [ -f $gtm_dist/gtcm_server ]; then
			$echo "Stopping GT.CM server(s) ...."
			ps -ef | grep gtcm_run | grep -v grep | awk '{ print "kill -15", $2 }' | sh > /dev/null 2>&1
			ps -ef | grep gtcm_s | grep -v grep |  awk '{ print "kill -15", $2, " ; sleep 1" }' | sh > /dev/null 2>&1
			sleep 10
			ps -ef | grep gtcm_s | grep -v grep > $tmpfile

			if [ $? -eq 0 ]
			then
			    $echo "server(s) did not respond to kill -15."
			    $echo "sending TRAP signal to the gtcm_server(s)."
			    ps -ef | grep gtcm_s | grep -v grep | awk '{ print "kill -5", $2, " ; sleep 2" }' | sh > /dev/null 2>&1
			    sleep 4
			fi
		fi

		if [ -f $gtm_dist/shmclean ]; then
			$echo "Cleaning up shared memory segments and semaphores..."
#
# Greystone suggests adding mupip rundown -region <name> for each region
# in your active databases.  This ensures flushing and deletion
# of the appropriate shared memory segments and semaphores.
#
# example:	        $gtm_dist/mupip rundown -region DEFAULT
#
			$gtm_dist/shmclean -q -d
			$gtm_dist/shmclean -q -s
		fi
		$echo "Shutdown complete."
	fi
fi