I'm trying to write a bash script which would relaunch my NodeJS server. This is how I'm launching the screen with the server:
screen -S web-server -d -m node web-server.js
which end up in this (which means it's working):
$ ps -Af | grep node ubuntu 19504 1 0 10:20 ? 00:00:00 SCREEN -S web-server -d -m sudo node web-server.js root 19506 19504 0 10:20 pts/2 00:00:00 sudo node web-server.js root 19507 19506 8 10:20 pts/2 00:00:00 node web-server.js
And this is how I'm trying to kill that server:
screen -S web-server -X quit
Which actually end up in a zombie process (the server ppid changes to 1):
$ ps -Af | grep node root 19506 1 0 10:20 ? 00:00:00 sudo node web-server.js root 19507 19506 0 10:20 ? 00:00:00 node web-server.js
How do I kill that screen session including the running process inside?
To those of you who may concern - the reason why I need sudo in screen is that I'm running the server on port 80 for which node requires super user permissions.