| Server IP : 172.64.80.1 / Your IP : 216.73.216.175 Web Server : LiteSpeed System : Linux srv13.swhc.ca 4.18.0-553.126.2.lve.el8.x86_64 #1 SMP Thu May 28 14:12:30 UTC 2026 x86_64 User : hongluck ( 2522) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /lib64/nagios/plugins/ |
Upload File : |
#!/bin/bash
# This script checks whether the 'lifesigns' service is active and listening on TCP port 1022.
# It uses 'systemctl' to verify the service state and 'ss' to confirm the socket is in LISTEN mode.
# Returns:
# OK (0) - if the service is active and listening
# CRITICAL (2) - if the service is not active or not listening on port 1022
# Run the systemctl command and extract the value of "Active" field
listen=$(ss -tunl | awk '/0.0.0.0:1022/ {print $2}')
# Check the status and return the appropriate exit code
if [[ $listen == "LISTEN" ]]; then
echo "OK: Service lifesign is running"
exit 0
else
echo "Critical: Service lifesign is not running"
exit 2
fi