I changed my code to the following and got no errors just 0 on one
line then 5 then 0 then 5:

import re
import pexpect
import os
for h in range(1,31):
   pipe = os.popen('{ ' + 'whoami' + '; } 2>&1', 'r')
   m = pipe.read()
   sts = pipe.close()
   if str(h) != m:
       child = pexpect.spawn('su sage%s' % h)
       child.expect('Password:')
       child.sendline('sage')
       pipe = os.popen('{ ' + 'ps' + '; } 2>&1', 'r')
       g = pipe.read()
       sts = pipe.close()
       findpro = re.compile('\d{5}')
       j = findpro.findall(g)
       for i in j[1:len(j)]:
           os.system('kill %s' % i)
           os.system('exit')

On 6/27/07, Timothy Clemans <[EMAIL PROTECTED]> wrote:
> I tried killing all the other SAGE processes.
>
> import re
> import pexpect
> import os
> for h in range(1,31):
>     if h != 19:
>         child = pexpect.spawn('su sage%d' % h)
>         child.expect('Password:')
>         child.sendline('sage')
>         pipe = os.popen('{ ' + 'ps' + '; } 2>&1', 'r')
>         g = pipe.read()
>         sts = pipe.close()
>         findpro = re.compile('\d{5}')
>         j = findpro.findall(g)
>         for i in j:
>             os.system('kill %s' % i)
>
> I tried to protect myself but got "Connection to localhost closed."
>
>
>
> On 6/27/07, Michel <[EMAIL PROTECTED]> wrote:
> >
> > So the notebook processes are executing the actual sage commands?
> > What is then the "notebook server"?. Is it just the webserver?
> >
> > This seems indeed quite secure provided the server never executes code
> > somehow
> > under control of the user.
> >
> > Note: I still think notebook processes should be restarted
> > automatically (or on demand).
> > Having to push "restart" when you log in is confusing.
> >
> > Michel
> >
> >
> > On Jun 27, 9:56 am, "William Stein" <[EMAIL PROTECTED]> wrote:
> > > On 6/27/07, Michel <[EMAIL PROTECTED]> wrote:
> > >
> > > > Doing
> > >
> > > > sage: import os
> > > > sage: os.system('whoami')
> > > > sage10
> > > > sage: os.system("kill -9 `ps -u sage10 -o pid=`")
> > >
> > > > still seemed to throw me out.
> > >
> > > > Connection to localhost closed by remote host.
> > > > Connection to localhost closed.
> > >
> > > > Is that expected? Logging out and in again did not seem to restore
> > > > my connection.
> > >
> > > Hi, the three sage notebooks are still working fine for me.
> > > All what you did above does is kill the SAGE worksheet process
> > > for your individual worksheet -- I.e., you shot your own user in
> > > the foot.   It shouldn't (and doesn't) affect the overall
> > > SAGE notebook server in any nontrivial way, as far as I can tell.
> > >
> > > William
> >
> >
> > > >
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to