I have the following script, which starts X and launches a graphical program:
#!/bin/sh #startGraphics.sh #Starts X and runs the graphics program xinit /opt/common/graphics/bin/launchGraphics.sh & sleep 10 ; echo "Successfully launched graphics program!"
I added the sleep and echo because if I simply ran the script, it would kill X and the graphics program immediately as the SSH session closed. The problem is, although the sleep and echo make X and the graphics program start, the SSH session does not end.
However, if I manually SSH'd into the machine, then ran the startGraphics.sh script, then exited the SSH session once the X server and program started, they would continue to run, and the SSH session would not hang.
What am I doing wrong here? What is the correct way to do what I am attempting, i.e. how do I start X remotely with the graphics program and have the SSH session complete without hanging and without X immediately terminating?
Though I don't think it relevant to the problem, here is the launchGraphics.sh script, just in case:
#!/bin/sh #launchGraphics.sh #Starts the graphics program. Requires X to be running xrandr -s 1920x1050 ; /opt/common/graphics/bin/graphics --position 0,0 --mode 1 & /opt/common/graphics/bin/graphics --position 100,0 --mode 2 & /opt/common/graphics/bin/graphics --position 300,0 --mode 3