I have a nodejs server that executes commands through child_process.exec. One such command restarts the node instance (and a couple of other things).
The script does something like this:
- kill node
- kill programs node uses
- clear logs
- restart programs node uses
- restart node
I know this is not the best way of doing it, but my hands are tied (it's a released version of software and we can't restructure until the next release).
What's happening is that when I run the command, it kills node and then the rest of the script dies.
The default shell that node is using is sh, and that cannot be changed.
What are my options?
The server is running as root, so there won't be any permissions problems. I figure I'll have to start a new shell somehow, but I'm not entirely sure how to do that. I'd like to exit the current shell successfully, but that isn't a requirement, as long as I can get the an entire script separate from the current shell.