[Tutor] Offtopic: Re: killing bash, sshd... dangerous?

Eric Brunson brunson at brunson.com
Mon Oct 29 00:39:30 CET 2007


John wrote:
> No, mostly just playing around with scripting.... and I have a problem 
> sometimes with cygwin where logging out from bash session

Hi John,

This is a known bug.  The fix is to install a real operating system. 

For more info, please see one of the following: 

http://distrowatch.com
http://www.opensolaris.org
http://www.freebsd.org

;-)

Sincerely,
e.

> the xterm hangs, so this seems to fix it... but it's not really the 
> best solution... needs some mods, I'm sure.
>
>  
> On 10/28/07, *Tom Tucker* <tktucker at gmail.com 
> <mailto:tktucker at gmail.com>> wrote:
>
>     Instead of reading in an outputfile (.ps), try reading from command
>     output.  The correct terminology escapes me (for file in
>     os.popen(cmd).readlines():).
>
>     Are you looking for a auto logout method? For example if no activity
>     after X minutes kill the shell.  Bash and a few other shells have this
>     functionality already.
>
>
>
>
>
>     On 10/28/07, John <washakie at gmail.com <mailto:washakie at gmail.com>>
>     wrote:
>     > Hello, I've written a little script with the intention of
>     killing all of my
>     > bash, sshd sessions... is this dangerous? How could I make it
>     work so that
>     > it didn't kill the session it was run from (as it is I suppose I
>     have to run
>     > it with nohup):
>     >
>     >
>     >
>     > #!/usr/bin/env python
>     > import os
>     >
>     > cmd="ps -u myuser | grep 'bash' > .ps"
>     > os.system(cmd)
>     >
>     > pid=[]
>     > fid=open('.ps','r')
>     > for line in fid:
>     >         pid.append(line.split(' ')[0])
>     >
>     > for i in pid:
>     >         cmd="""kill -9 %s""" % (i)
>     >         os.system(cmd)
>     >
>     >
>     > cmd="ps -u myuser | grep 'sshd' > .ps"
>     > os.system(cmd)
>     >
>     > pid=[]
>     > fid=open('.ps','r')
>     > for line in fid:
>     >         pid.append(line.split(' ')[0])
>     >
>     > for i in pid:
>     >         cmd="""kill -9 %s""" % (i)
>     >         os.system(cmd)
>     >
>     > _______________________________________________
>     > Tutor maillist  -  Tutor at python.org <mailto:Tutor at python.org>
>     > http://mail.python.org/mailman/listinfo/tutor
>     >
>     >
>
>
>
>
> -- 
> Configuration
> ``````````````````````````
> Plone 2.5.3-final,
> CMF-1.6.4,
> Zope (Zope 2.9.7-final, python 2.4.4, linux2),
> Five 1.4.1,
> Python 2.4.4 (#1, Jul 3 2007, 22:58:17) [GCC 4.1.1 20070105 (Red Hat 
> 4.1.1-51)],
> PIL 1.1.6
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>   



More information about the Tutor mailing list