#!/bin/bash UNIT=$1 systemctl status $UNIT > /dev/null RET=$? if [[ $RET != 0 ]]; then echo "SERVICE $UNIT - CRITICAL: Not running" exit 2 fi echo "SERVICE $UNIT - OK" exit 0