Created
January 21, 2017 13:01
-
-
Save bartread/c2b94ac871f47c61974460bb618f5827 to your computer and use it in GitHub Desktop.
Ubuntu 16 - reliably find node processes and take conditional action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
NODEPROCESSES=$(ps -aux | grep '[s]udo nohup node index.js' | awk '{print $2}') | |
if [ -n "$NODEPROCESSES" ]; then | |
echo "Found node processes $NODEPROCESSES" | |
else | |
echo "No node processes found" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Of course, this presupposes node has been run as a background process from directly from a shell, or from a shell script, rather than as a service.