Revision 9009,
636 bytes
checked in by ghudson, 28 years ago
(diff) |
This commit was generated by cvs2svn to compensate for changes in r9008,
which included commits to RCS files with non-trunk default branches.
|
Line | |
---|
1 | #!/usr/bin/perl |
---|
2 | |
---|
3 | # $Header: /afs/dev.mit.edu/source/repository/third/perl/eg/shmkill,v 1.1.1.1 1996-10-02 06:40:05 ghudson Exp $ |
---|
4 | |
---|
5 | # A script to call from crontab periodically when people are leaving shared |
---|
6 | # memory sitting around unattached. |
---|
7 | |
---|
8 | open(ipcs,'ipcs -m -o|') || die "Can't run ipcs: $!"; |
---|
9 | |
---|
10 | while (<ipcs>) { |
---|
11 | $tmp = index($_,'NATTCH'); |
---|
12 | $pos = $tmp if $tmp >= 0; |
---|
13 | if (/^m/) { |
---|
14 | ($m,$id,$key,$mode,$owner,$group,$attach) = split; |
---|
15 | if ($attach != substr($_,$pos,6)) { |
---|
16 | die "Different ipcs format--can't parse!\n"; |
---|
17 | } |
---|
18 | if ($attach == 0) { |
---|
19 | push(@goners,'-m',$id); |
---|
20 | } |
---|
21 | } |
---|
22 | } |
---|
23 | |
---|
24 | exec 'ipcrm', @goners if $#goners >= 0; |
---|
Note: See
TracBrowser
for help on using the repository browser.