]>
Commit | Line | Data |
---|---|---|
9420d22f CW |
1 | #!/bin/sh |
2 | # $Id$ | |
3 | ||
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
6 | # the Free Software Foundation; either version 2 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
17 | ` | |
18 | ||
19 | syntaxe() | |
20 | { | |
21 | echo "" | |
22 | echo "IPC destruction" | |
23 | echo "---------------" | |
24 | echo "" | |
25 | echo " ipck [all | allsem | allmsg | allshm]" | |
26 | echo "" | |
27 | } | |
28 | ||
29 | if test $# -eq 1 | |
30 | then | |
31 | case $1 in | |
32 | all) | |
33 | echo "kill all ipc" | |
34 | a=`ipcs | grep "_sem" | awk '{print $2}'` | |
35 | if test " $a" != " " | |
36 | then | |
37 | ipcrm sem $a | |
38 | fi | |
39 | a=`ipcs | grep "_shm" | awk '{print $2}'` | |
40 | if test " $a" != " " | |
41 | then | |
42 | ipcrm shm $a | |
43 | fi | |
44 | a=`ipcs | grep "_msg" | awk '{print $2}'` | |
45 | if test " $a" != " " | |
46 | then | |
47 | ipcrm msg $a | |
48 | fi | |
49 | ;; | |
50 | allsem) | |
51 | echo "kill all sem" | |
52 | a=`ipcs | grep "_sem" | awk '{print $2}'` | |
53 | if test " $a" != " " | |
54 | then | |
55 | ipcrm sem $a | |
56 | fi | |
57 | ;; | |
58 | allmsg) | |
59 | echo "kill all msg" | |
60 | a=`ipcs | grep "_msg" | awk '{print $2}'` | |
61 | if test " $a" != " " | |
62 | then | |
63 | ipcrm msg $a | |
64 | fi | |
65 | ;; | |
66 | allshm) | |
67 | echo "kill all shm" | |
68 | a=`ipcs | grep "_shm" | awk '{print $2}'` | |
69 | if test " $a" != " " | |
70 | then | |
71 | ipcrm shm $a | |
72 | fi | |
73 | ;; | |
74 | *) | |
75 | syntaxe | |
76 | ;; | |
77 | esac | |
78 | else | |
79 | syntaxe | |
80 | fi |