Skip to main content
Post Reopened by Gilles 'SO- stop being evil', jasonwryan, slm, Anthon, Mat
Title more clear that X is involved
Link
apdnu
  • 172
  • 7

Keep running python scriptprogram requiring X server after logging off of ssh session

Post Closed as "Duplicate" by slm, Anthon, Drav Sloan, manatwork, user
X session probably to blame
Source Link
apdnu
  • 172
  • 7

I have a python script that periodically generates a png image, and puts it on a server that I can access through a browser. The image displays the progress of a job I am running on the server. I'm using matplotlib to generate the images.

The python script goes to sleep after generating each image. After an hour, it wakes up, generates a new image, and then goes back to sleep.

I start the script over an ssh session. When I log off, the script gets killed. I've read the other threads covering this problem, but the proposed solutions do not work. The script is killed after I log off, even if I run it with

nohup script.py &> job-monitor.log & 

or if I run it like this

script.py [Ctrl-Z] disown -h %1 bg 1 

The strange thing is, when I log off and log back in, the script is no longer running, and job-monitor.log is empty.

What could be happening, and how do I get the script to continue running after I log off?

Additional information: I think the problem has to do with the plotting library I'm using, matplotlib. I think it may require an X session to produce a png, even though the graphic is just being saved to disk.

I have a python script that periodically generates a png image, and puts it on a server that I can access through a browser. The image displays the progress of a job I am running on the server. I'm using matplotlib to generate the images.

The python script goes to sleep after generating each image. After an hour, it wakes up, generates a new image, and then goes back to sleep.

I start the script over an ssh session. When I log off, the script gets killed. I've read the other threads covering this problem, but the proposed solutions do not work. The script is killed after I log off, even if I run it with

nohup script.py &> job-monitor.log & 

or if I run it like this

script.py [Ctrl-Z] disown -h %1 bg 1 

The strange thing is, when I log off and log back in, the script is no longer running, and job-monitor.log is empty.

What could be happening, and how do I get the script to continue running after I log off?

I have a python script that periodically generates a png image, and puts it on a server that I can access through a browser. The image displays the progress of a job I am running on the server. I'm using matplotlib to generate the images.

The python script goes to sleep after generating each image. After an hour, it wakes up, generates a new image, and then goes back to sleep.

I start the script over an ssh session. When I log off, the script gets killed. I've read the other threads covering this problem, but the proposed solutions do not work. The script is killed after I log off, even if I run it with

nohup script.py &> job-monitor.log & 

or if I run it like this

script.py [Ctrl-Z] disown -h %1 bg 1 

The strange thing is, when I log off and log back in, the script is no longer running, and job-monitor.log is empty.

What could be happening, and how do I get the script to continue running after I log off?

Additional information: I think the problem has to do with the plotting library I'm using, matplotlib. I think it may require an X session to produce a png, even though the graphic is just being saved to disk.

Source Link
apdnu
  • 172
  • 7

Keep running python script after logging off of ssh session

I have a python script that periodically generates a png image, and puts it on a server that I can access through a browser. The image displays the progress of a job I am running on the server. I'm using matplotlib to generate the images.

The python script goes to sleep after generating each image. After an hour, it wakes up, generates a new image, and then goes back to sleep.

I start the script over an ssh session. When I log off, the script gets killed. I've read the other threads covering this problem, but the proposed solutions do not work. The script is killed after I log off, even if I run it with

nohup script.py &> job-monitor.log & 

or if I run it like this

script.py [Ctrl-Z] disown -h %1 bg 1 

The strange thing is, when I log off and log back in, the script is no longer running, and job-monitor.log is empty.

What could be happening, and how do I get the script to continue running after I log off?