[Tutor] Running a script in the background
alan.gauld at btinternet.com
Mon Sep 3 00:30:57 CEST 2012
On 02/09/12 23:14, Ray Jones wrote:
> could run silently in the background. But is there a way for a Python
> (2.7.3) script to determine whether it was called by the user or called
> by something like cron or kalarm? That way user inputs could be used
> when called by a user, but defaults could be used if run by a bot.
Yes you can query the user via the os module.(getuid or getlogin for
> Or is this more of a Linux question?
The details are likely to be implementation dependant, differing even
between local hosts since it depends on how the admin has set up the
user for cron etc
Author of the Learn to Program web site
More information about the Tutor