How to logout from a Python Program?

Chad Netzer cnetzer at mail.arc.nasa.gov
Thu Oct 10 17:57:45 EDT 2002


On Thursday 10 October 2002 14:23, Erik Max Francis wrote:
> so you might be forced to use
> KILL, which makes the prospects even less satisfying.

The brute force method:

os.kill( -1, 15 )       # TERM signal
time.sleep( 10 )
os.kill( -1, 9 )        # KILL signal

Not portable across all unixes, and very indescriminant (it'll kill ALL 
processes that you have permission to kill), but will likely log you out.

If you want to leave things running in the background, and still log out, 
then you could you "nohup" to run your long running processes, and try:

os.kill( -1, 1 )   # HUP signal

If you are not on Unix/Linux, then these won't work, btw.

-- 

Chad Netzer
cnetzer at mail.arc.nasa.gov




More information about the Python-list mailing list