I have a node app running on my Linux hosting server.
Sometimes the app crashes and I need to restart it, so I log in and type these commands:
pkill node cd public_html/n49900_dpndev node server.js & And the app runs again.
Now I would like to put this into a script so I simply need to start the script (or can execute it from a PHP script, for instance).
I created a file called "startnode":
#!/bin/bash pkill node cd public_html/n49900_dpndev node server.js & I changed the permissions with chmod 755 startnode.
But when I execute it with ./startnode it responds with:
Terminated
What do I need to do so that the commands I type in manually also work in the bash script?
-xto your first line:#!/bin/bash -xThat will show your verbose/debug node and you can see where the terminated appears. Does node or server.js require an interactive shell?