This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: SSH connection caching
On 2005-10-28 14:12:26 +0100, Dave Korn wrote:
> Dunno what's recommended, but I expect you should be able to come
> up with a combination of ps/grep/awk/cut that you could put in a
> backtick as an argument to "kill -9" in your .logout file, perhaps?
I use lsof. With zsh:
for file in /tmp/ssh-*(=N)
do
pids=($(lsof -F f -U -a -c ssh -a "$file" 2>/dev/null))
if [[ $#pids == 2 ]] then
pid=${pids[1]#p}
echo "kill $pid (socket $file)"
kill -TERM $pid
fi
done
Executed only when my last login shell exits.
--
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA