Skip to content

Instantly share code, notes, and snippets.

@yazanmonshed
Created January 17, 2023 10:27
Show Gist options
  • Save yazanmonshed/7836e78c2b433cda3a044324d4878ade to your computer and use it in GitHub Desktop.
Save yazanmonshed/7836e78c2b433cda3a044324d4878ade to your computer and use it in GitHub Desktop.
Check status service using Bash script with Jenkins
#!/bin/bash
# Check the status of the service
# Pass as param from Jenkins Server
service=$1
if systemctl is-active --quiet $service; then
echo "$service is running."
else
echo "$service is not running."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment