Last active
December 8, 2017 20:02
-
-
Save isidroamv/2a4ebf357edad0ab24d3832c8b73b485 to your computer and use it in GitHub Desktop.
Restart process if crash on Linux
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 | |
# Add this file as a crontab task | |
# Example: * * * * * bash /opt/dir/task/stayalive.sh | |
# If the collector is not runing, execute it | |
if [[ ! `pgrep -f "python main.py"` ]]; then | |
cd /opt/dir/process && ./process-name | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment