CHips L MINI SHELL

CHips L pro

Current Path : /opt/zabbix_scripts/
Upload File :
Current File : //opt/zabbix_scripts/check_PuppetServiceStatus.sh

#!/bin/bash
################################################################################################################
#                                                                                                              #
# !!!!!!!!!!! This file is managed by Puppet.  Do not edit directly.  Changes will be overwritten. !!!!!!!!!!! #
#                                                                                                              #
# Author:   William O.                                                                                         #
# Revision: 20201012.1103                                                                                      #
################################################################################################################


declare centOSVersion=$(cat /etc/redhat-release | cut -d\. -f1)

case ${centOSVersion} in
    "CentOS Linux release 7")
        statusCommand='systemctl show -p SubState puppet.service'
        ;;
    "CentOS release 6")
        statusCommand='/etc/init.d/puppet status'
        ;;
    *)
esac


declare puppetServiceStatus=`${statusCommand}`

if [ "${puppetServiceStatus}" = "SubState=dead" ] || [ "${puppetServiceStatus}" = "puppet is stopped" ] || [ "${puppetServiceStatus}" = "puppet dead but pid file exists" ] || [ "${puppetServiceStatus}" = "puppet dead but subsys locked" ]
then
    echo "Stopped"
elif [[ "${puppetServiceStatus}" == *"running"* ]]
then
    echo "Running"
fi

Copyright 2K16 - 2K18 Indonesian Hacker Rulez