home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
zkuste
/
Perl
/
ActivePerl-5.6.0.613.msi
/
䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥
/
_8980299f99660b9d9ec8302fead07e86
< prev
next >
Wrap
Text File
|
2000-03-15
|
614b
|
25 lines
#!/usr/bin/perl
# $RCSfile: shmkill,v $$Revision: 4.1 $$Date: 92/08/07 17:20:45 $
# A script to call from crontab periodically when people are leaving shared
# memory sitting around unattached.
open(ipcs,'ipcs -m -o|') || die "Can't run ipcs: $!";
while (<ipcs>) {
$tmp = index($_,'NATTCH');
$pos = $tmp if $tmp >= 0;
if (/^m/) {
($m,$id,$key,$mode,$owner,$group,$attach) = split;
if ($attach != substr($_,$pos,6)) {
die "Different ipcs format--can't parse!\n";
}
if ($attach == 0) {
push(@goners,'-m',$id);
}
}
}
exec 'ipcrm', @goners if $#goners >= 0;