Launch script on Linux using Putty
maxime.p at gmail.com
Mon Apr 2 19:51:18 CEST 2007
On Apr 2, 12:56 am, Michael Hoffman <cam.ac... at mh391.invalid> wrote:
> Ulysse wrote:
> > Hello,
> > I have a python script which runs all the time (using of library
> > threading). I would like this scipt to run on a remote linux Os using
> > Putty. The problem is, when I close Putty command line window running
> > on my Win PC, the python script stops to run too.
> > I tried to use cron tables instead. By setting the time and restart
> > cron process, but it's not practical.
> > Do you know the right way to do this ?
> There are a few ways to do this, in order of easiest to most involved:
> 1. The easiest is to run nohup on your script in the background:
> $ nohup myscript.py > output.txt 2> error.txt &
> Then you can disconnect but your script will keep running. Try man nohup
> for more information.
> 2. Use GNU screen on your remote terminal, and detach the screen instead
> of logging off.
> 3. Set up your script to fork as a daemon. Google for ["python cookbook"
> fork daemon] to find a few recipes for this.
> Michael Hoffman
Thanks a lot but in my situation :
1. nohup seems not to be installed on my "reduced linux distribution".
It's a OpenWrt tunning on my WRT54GL Broadband router.
2. I have looked for the way I can "detach the screen" with Putty but
I've not found (May be you can precise ?)
3. The "fork daemon" script found on http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/278731
seems to be as huge as my own script and little bit hard to undestand.
So maybe "detach the screen" ?
More information about the Python-list