diff --git a/rc/bin/aanuke b/rc/bin/aanuke new file mode 100755 index 000000000..efafa29c4 --- /dev/null +++ b/rc/bin/aanuke @@ -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)' +} diff --git a/sys/man/8/aan b/sys/man/8/aan index 430c89b82..a3230d9c9 100644 --- a/sys/man/8/aan +++ b/sys/man/8/aan @@ -1,6 +1,6 @@ .TH AAN 8 .SH NAME -aan \- always available network +aan, aanuke \- always available network .SH SYNOPSIS .B aan .B -c @@ -19,6 +19,7 @@ aan \- always available network [ .B -m maxto ] +.B aanuke .I netdir .SH DESCRIPTION .I Aan @@ -64,7 +65,22 @@ option of .IR import (4) and .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 .I aan is encapsulated in @@ -89,6 +105,14 @@ using this command: .EX import -p astro6 / /mnt/term .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 .TF /sys/log/aan .TP @@ -96,6 +120,8 @@ import -p astro6 / /mnt/term Log file .SH SOURCE .B /sys/src/cmd/aan.c +.br +.B /rc/bin/aanuke .SH SEE ALSO .IR import (4), .IR exportfs (4),