forked from Coastal-Imaging-Research-Network/hotm2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanmsg
More file actions
33 lines (21 loc) · 613 Bytes
/
cleanmsg
File metadata and controls
33 lines (21 loc) · 613 Bytes
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
#! /usr/bin/perl
open( I, "</proc/sysvipc/msg" ) || die "canot open ipc: $!\n";
$skip = shift or $skip = 1;
print "skip: $skip\n";
$j = <I>;
while(<I>) {
($pid, $id, $rest) = split(' ');
print "$pid $id... ";
do { print "skipping\n"; next; } if hex($pid) < 20 and hex($pid) > 0 and $skip > 0;
system( "ipcrm -q $id" );
print "done\n";
}
open( I, "</proc/sysvipc/shm" ) || die "canot open ipc: $!\n";
$j = <I>;
while(<I>) {
($pid, $id, $rest) = split(' ');
print "$pid $id... ";
#do { print "skipping\n"; next; } unless $pid > 0;
system( "ipcrm -m $id" ) unless $pid > 0;;
print "done\n";
}