Skip to content

Instantly share code, notes, and snippets.

@bvpatel
Created October 17, 2019 12:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bvpatel/aeb350d09c17b40d7ebcc87f64f36d57 to your computer and use it in GitHub Desktop.
Save bvpatel/aeb350d09c17b40d7ebcc87f64f36d57 to your computer and use it in GitHub Desktop.
Monitoring linux services
#!/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