Created
May 4, 2017 03:16
-
-
Save erickvasilev/cf4af254b9e328687a3b967dc54f666a to your computer and use it in GitHub Desktop.
Restart NodeJS App If Down/Crash
This file contains 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/bash | |
pm2 show myapp | grep "stopped" | |
if [ $? -eq 0 ]; then | |
printf 'NodeJS App is not running....' | |
#i use PM2 to manage app | |
pm2 start myapp | |
else | |
printf 'NodeJS App is running' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment