[Tutor] Running a script in the background

Ray Jones crawlzone at gmail.com
Mon Sep 3 00:36:49 CEST 2012


On 09/02/2012 03:30 PM, Alan Gauld wrote:
> 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
> example)
>
>> 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
>

Thanks. I'll add this to my to-learn list (It's frustrating to come up
with questions and answers faster than I can assimilate it all :-p)


Ray


More information about the Tutor mailing list