<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&#39;s not really the best solution... needs some mods, I&#39;m sure.
<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 10/28/07, <b class="gmail_sendername">Tom Tucker</b> &lt;<a href="mailto:tktucker@gmail.com">tktucker@gmail.com</a>&gt; 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.&nbsp;&nbsp;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.&nbsp;&nbsp;Bash and a few other shells have this<br>functionality already.<br><br><br><br>
<br><br>On 10/28/07, John &lt;<a href="mailto:washakie@gmail.com">washakie@gmail.com</a>&gt; wrote:<br>&gt; Hello, I&#39;ve written a little script with the intention of killing all of my<br>&gt; bash, sshd sessions... is this dangerous? How could I make it work so that
<br>&gt; it didn&#39;t kill the session it was run from (as it is I suppose I have to run<br>&gt; it with nohup):<br>&gt;<br>&gt;<br>&gt;<br>&gt; #!/usr/bin/env python<br>&gt; import os<br>&gt;<br>&gt; cmd=&quot;ps -u myuser | grep &#39;bash&#39; &gt; .ps&quot;
<br>&gt; os.system(cmd)<br>&gt;<br>&gt; pid=[]<br>&gt; fid=open(&#39;.ps&#39;,&#39;r&#39;)<br>&gt; for line in fid:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pid.append(line.split(&#39; &#39;)[0])<br>&gt;<br>&gt; for i in pid:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd=&quot;&quot;&quot;kill -9 %s&quot;&quot;&quot; % (i)
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; os.system(cmd)<br>&gt;<br>&gt;<br>&gt; cmd=&quot;ps -u myuser | grep &#39;sshd&#39; &gt; .ps&quot;<br>&gt; os.system(cmd)<br>&gt;<br>&gt; pid=[]<br>&gt; fid=open(&#39;.ps&#39;,&#39;r&#39;)<br>&gt; for line in fid:
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pid.append(line.split(&#39; &#39;)[0])<br>&gt;<br>&gt; for i in pid:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd=&quot;&quot;&quot;kill -9 %s&quot;&quot;&quot; % (i)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; os.system(cmd)<br>&gt;<br>&gt; _______________________________________________
<br>&gt; Tutor maillist&nbsp;&nbsp;-&nbsp;&nbsp;<a href="mailto:Tutor@python.org">Tutor@python.org</a><br>&gt; <a href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a><br>&gt;<br>&gt;<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