diff options
author | gclarkii <gclarkii@FreeBSD.org> | 1994-09-10 06:27:55 +0000 |
---|---|---|
committer | gclarkii <gclarkii@FreeBSD.org> | 1994-09-10 06:27:55 +0000 |
commit | bd9f08584221a6bacbfeaebf19d4c3e21fa94a83 (patch) | |
tree | 8e0cf41774fd52d25f63363297782b383c4ad1f7 /gnu/usr.bin/perl/eg/shmkill | |
download | FreeBSD-src-bd9f08584221a6bacbfeaebf19d4c3e21fa94a83.zip FreeBSD-src-bd9f08584221a6bacbfeaebf19d4c3e21fa94a83.tar.gz |
Initial import of Perl 4.046 bmaked
Diffstat (limited to 'gnu/usr.bin/perl/eg/shmkill')
-rw-r--r-- | gnu/usr.bin/perl/eg/shmkill | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/eg/shmkill b/gnu/usr.bin/perl/eg/shmkill new file mode 100644 index 0000000..e8d1b11 --- /dev/null +++ b/gnu/usr.bin/perl/eg/shmkill @@ -0,0 +1,24 @@ +#!/usr/bin/perl + +# $Header: /home/cvs/386BSD/ports/lang/perl/eg/shmkill,v 1.1.1.1 1993/08/23 21:29:43 nate Exp $ + +# 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; |