Created
November 1, 2023 14:07
-
-
Save NeilMasters/f91effe4d561e02c9c22db3ede1d4c79 to your computer and use it in GitHub Desktop.
monitor node service and restart if required
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 | |
# This small script will check the running processes for the | |
# node service running the application. If it is not found it | |
# will start another instance of the service. | |
SOCKET_SERVICES_RUNNING=$(ps -aux | grep "[n]ode index.js") | |
if [ "${SOCKET_SERVICES_RUNNING}" == ""]; then | |
cd /srv/app && (npm run serve&) | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment