[Tutor] Timer with exe command
Alan Gauld
alan.gauld at btinternet.com
Tue Mar 1 02:20:33 CET 2011
"Kaden McLaws" <killerpancakes at msn.com> wrote
> I would like to set up the following using python:
> A timer that is activated when a user logs on to our computer,
> then shuts the computer down when the timer runs out
You can do that from the Operating System, no programming
required. But hopw you do it wioll depend on which Operating
System you are running, which is about the only thing you
omit to mention!
Assuming it's Windows take a look at the 'at' command...
If its Linux or MacOS try 'cron'
> parsing. It would be effective if the last time the timer activated
> was recorded in a txt file, logged, so that the program can
> check and ensure that the last time the timer ended was
> at least 12 hours ago, so the computer just isnt turned
> right back on for another 90 mins repeatedly.
That's a little bit more tricky but doable in a startup script.
Python might be a suitable medium for that task.
> Is there also a way to run the python hidden in the
> background so he cannot just figure out how to close it?
Not really. If he knows how to drive the OS well then pretty
much anything you do can be traced. You can of course
disguise the name of the script so it looks harmless, but
you can't hide the interpreter - unless you have a
separate copy with an obscure name...
HTH,
Alan G.
More information about the Tutor
mailing list