summaryrefslogtreecommitdiff
path: root/qa/src/ipcs_clear
diff options
context:
space:
mode:
Diffstat (limited to 'qa/src/ipcs_clear')
-rwxr-xr-xqa/src/ipcs_clear39
1 files changed, 39 insertions, 0 deletions
diff --git a/qa/src/ipcs_clear b/qa/src/ipcs_clear
new file mode 100755
index 0000000..f46794a
--- /dev/null
+++ b/qa/src/ipcs_clear
@@ -0,0 +1,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