[Tutor] Fwd: Running a script in the background

Walter Prins wprins at gmail.com
Sun Sep 2 16:06:41 CEST 2012


forwarding accidental reply to person only


---------- Forwarded message ----------
From: Walter Prins <wprins at gmail.com>
Date: 2 September 2012 15:05
Subject: Re: [Tutor] Running a script in the background
To: Michael Lewis <mjolewis at gmail.com>


On 2 September 2012 05:00, Michael Lewis <mjolewis at gmail.com> wrote:
>
>> For windows not sure but for osx just add an & after the command.
>>
>> python myscript.py &
>
>
> Thanks, but I know about that. I should have been more clear. What I want to
> do is have the script run in the background without even seeing the
> terminal. Adding the & after the command will let do other things, but the
> terminal still needs to be open. Once the program is running, I don't want
> either the terminal or the interpreter displayed.

try:

nohup python myscript.py &

Then you can close the terminal afterwards.  "nohup" means"no hangup".
 It tells the system that the python process launched as a result of
this command should not be terminated when its parent shell is
terminated.

You can also put the above command in a shell script and run the
script directly via whatever method suits you best. (Launcher,
scheduled job, login script etc.)

Walter


-- 
Walter Prins
Trendata Solutions Limited
26 Kirfield Drive, Hinckley, Leicestershire, LE10 1SX
Tel: 01455 635 994 (fax/landline)   077 8713 1543 (mobile)  Email:
info at trendatasolutions.ltd.uk
Registered Office: 8 Emmanuel Court, 10 Mill Street, Birmingham, B72 1TJ
Company registered in England No: 07364060         VAT No: 998 3569 37


More information about the Tutor mailing list