Monday, 9 September 2013

Starting a new screen session to run a script that starts another one

Starting a new screen session to run a script that starts another one

I'm trying to make a program using node.js that needs to be able to pull
new updates and restart it self. For that purpose, I've made an auto.sh
script that has this code in it:
screen -S GNode -X quit
screen -dmS GNode -L node server
Unfortunately, when I try to run that script from node, what appears to
happen is that the first line is ran and my node application shuts down
(as it's being run in that session) but then the second line doesn't get
executed, which is a bummer.
What I've ended up doing is having ANOTHER screen session called
ScriptRunner that I run with the command
screen -dmS ScriptRunner sh auto.sh
For some reason though, when I run that command and then check for open
screen sessions, there are none. So the first line again gets executed but
the second one doesn't. This doesn't appear to be a problem with my node
program because when I run that last command directly in the terminal, the
same thing happens.
Does anyone know what could possibly be wrong? I'm very new to Linux and
terminal stuff.

No comments:

Post a Comment