Good idea!
Unfortunately, bash doesn't seem to run .bash_logout before exiting.
I'm invoking it with --login, and I've verified that .bash_profile is being run. Also, running bash manually, it does run .bash_logout upon exiting.
Perhaps bash is being killed more brutally than I first thought?
If it is of any interest, the line in inetd.conf currently looks like this:
telnet stream tcp6 nowait root /usr/sbin/tcpd in.telnetd -L /usr/local/bin/loginmixer
loginmixer is a simple script with just one line:
exec /bin/bash --login /usr/local/bin/aumixbark
aumixbark is the script that launches alsamixer (yes it's a bad name...).
It's a bit of a mess since I was unable to figure out how to give options to the login program directly from inetd.conf.
If I leave exec out of loginmixer the only difference is that I have one extra process running while the telnet session is up. When telnetd dies, so does loginmixer, but alsamixer still keeps going.
Any ideas as to what is really going on here?