add /rc/bin/aanuke

This commit is contained in:
stanley lieber 2014-04-14 19:05:57 -04:00
parent f02f05ca6a
commit 0812a26f00
2 changed files with 34 additions and 2 deletions

6
rc/bin/aanuke Executable file
View file

@ -0,0 +1,6 @@
#!/bin/rc
rfork e
for(i in `{ps | grep -e '[ ]+aan$' | awk '{print $2}'}){
if(! grep -s -e '[ ]+\/net\/tcp\/[0-9]+\/data$' /proc/$i/fd)
echo '@{echo kill>/proc/'$i'/note} # aan (idle)'
}

View file

@ -1,6 +1,6 @@
.TH AAN 8 .TH AAN 8
.SH NAME .SH NAME
aan \- always available network aan, aanuke \- always available network
.SH SYNOPSIS .SH SYNOPSIS
.B aan .B aan
.B -c .B -c
@ -19,6 +19,7 @@ aan \- always available network
[ [
.B -m maxto .B -m maxto
] ]
.B aanuke
.I netdir .I netdir
.SH DESCRIPTION .SH DESCRIPTION
.I Aan .I Aan
@ -64,7 +65,22 @@ option of
.IR import (4) .IR import (4)
and and
.IR cpu (1). .IR cpu (1).
.SH EXAMPLE .PP
.I Aanuke
prints commands that will cause all processes called
.I aan
that are owned by the current user and do not have an
active tcp connection to be terminated.
Use the
.B send
command of
.IR rio (1),
or pipe the output of
.I kill
into
.IR rc (1)
to execute the commands.
.SH EXAMPLES
Assume the server part of Assume the server part of
.I aan .I aan
is encapsulated in is encapsulated in
@ -89,6 +105,14 @@ using this command:
.EX .EX
import -p astro6 / /mnt/term import -p astro6 / /mnt/term
.EE .EE
.PP
Kill idle instances of
.I aan
left behind by a terminal that has been powered off:
.IP
.EX
aanuke | rc
.EE
.SH FILES .SH FILES
.TF /sys/log/aan .TF /sys/log/aan
.TP .TP
@ -96,6 +120,8 @@ import -p astro6 / /mnt/term
Log file Log file
.SH SOURCE .SH SOURCE
.B /sys/src/cmd/aan.c .B /sys/src/cmd/aan.c
.br
.B /rc/bin/aanuke
.SH SEE ALSO .SH SEE ALSO
.IR import (4), .IR import (4),
.IR exportfs (4), .IR exportfs (4),