Created
October 17, 2019 12:21
-
-
Save bvpatel/aeb350d09c17b40d7ebcc87f64f36d57 to your computer and use it in GitHub Desktop.
Monitoring linux services
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/bash | |
service=$@ | |
/bin/systemctl -q is-active "$service.service" | |
status=$? | |
if [ "$status" == 0 ]; then | |
echo "OK" | |
else | |
/bin/systemctl start "$service.service" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment