loggin out automatically
Cameron Laird
claird at lairds.com
Fri Nov 8 09:37:38 EST 2002
In article <omubqa.812.ln at anto.cuni.lan>,
Antonio Cuni <TOGLIMIcuni at programmazione.it> wrote:
>trewornan wrote:
>
>> I am responsible for maintaining a PC in a hotel which is available for
>> use of guests, basically just e-mail and web browsing. We are currently
>> using a program called "timewatcher" which allows me to provide "access
>> codes" each code providing a particular period of access - 20, 30, 60
>> min or whatever
>
>You could use this script as the default shell for guests; it
>automatically kills bash after a fixed amount of time:
>
>import os
>import time
>import signal
>
>MAX_LOGIN_TIME = 5 # seconds
>
>pid = os.fork()
>
>if pid == 0:
> # the child
> os.execv('/bin/bash', ['/bin/bash'])
>else:
> # the parent
> time.sleep(MAX_LOGIN_TIME)
> os.kill(pid, signal.SIGTERM)
.
.
.
Seconded. Something like this will probably serve you
even better than your current "timewatcher". I think
you'll end up pleasantly surprised at how simple and
flexible such operations are under Linux.
--
Cameron Laird <Cameron at Lairds.com>
Business: http://www.Phaseit.net
Personal: http://phaseit.net/claird/home.html
More information about the Python-list
mailing list