loggin out automatically
Kyler Laird
Kyler at news.Lairds.org
Sat Nov 9 12:24:25 EST 2002
>>> 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:
[good simple Python script]
>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.
Speaking of flexibility, I suggest that after the time
has expired, you check a file for a new code. This
would allow the user to acquire (buy? beg?) more time
and then use it without having to restart everything.
A setuid script could be used to update the file.
I'd probably also do something more complex than this:
os.kill(pid, signal.SIGTERM)
Maybe just HUP it first and then TERM/KILL it later? I
am thinking it would be good to give it a chance to
save data.
You're going to run an X server for all of this, not
just give users a command shell, right? You could just
use a similar script to end it.
--kyler
More information about the Python-list
mailing list