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