1

I have to run a python script in the background in my server. I am using the command:

nohup python MyScript.py &

in the command line. Now, when after running this I close the connection and log out and log in back it fails, I see that its not running anymore. Any ideas?

EDIT I am using Putty software to log into my server and from there am trying it.

3
  • 2
    I don't have a direct answer to your question, but it was because of problems like this that I started using the screen utility. Screen basically creates subshells and allows you to detach them from your current session. So in these cases you would load screen, start the script, detach your screen, log out. Then check back in a couple hours by logging on to the server and reattaching your screen. Check it out.
    – Safado
    Mar 4, 2016 at 16:19
  • anything in nohup.out?
    – BeerSerc
    Mar 4, 2016 at 16:20
  • @BeerSerc yeah the code is running corectly and I can seee it when I am logged in. But when I come back it was stopped. Mar 4, 2016 at 16:23

1 Answer 1

2

Try:

nohup python MyScript.py &
disown
1
  • yeah used bg %1 disown -h %1. Thanks Mar 4, 2016 at 17:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .