summaryrefslogtreecommitdiff
path: root/qa/src/ipcs_clear
blob: f46794acf8d231370b76b3ec3c50c2e8919a4af7 (plain)
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
#! /bin/sh
#
# Copyright (c) 1997-2002 Silicon Graphics, Inc.  All Rights Reserved.
#
# Cleanup my seamphores and shared memory segments ... leave
# smh segment id 0, things owned by root and/or Oracle
#

# Get standard environment
. $PCP_DIR/etc/pcp.env

if [ $PCP_PLATFORM = irix ]
then
    ipcrm `ipcs -ms | $PCP_AWK_PROG '
$5 == "root"		{ next }
$5 == "oracle"		{ next }
$5 == "sybase"		{ next }
$5 == "informix"	{ next }
/^m/		{ if ($2 != 0) printf "-m %d ", $2 }
/^s/		{ printf "-s %d ", $2 }
END		{ print "" }'`
elif [ $PCP_PLATFORM = linux ]
then
    ipcs -ms | $PCP_AWK_PROG '
$5 == "root"		{ next }
$5 == "oracle"		{ next }
$5 == "sybase"		{ next }
$5 == "informix"	{ next }
/^m/		{ if ($2 != 0) print "shm %d", $2 }
/^s/		{ print "sem %d", $2 }' \
    | while read args
    do
	ipcrm $args
    done
else
    bozo! - how do you do this ipc stuff
fi

exit 0