mirror of
https://github.com/m8tin/cis.git
synced 2025-12-06 15:58:26 +01:00
15 lines
552 B
Bash
Executable File
15 lines
552 B
Bash
Executable File
#!/bin/bash
|
|
|
|
_SERVER="${1:?"FQDN of server missing"}"
|
|
_PORT="${2:-"22"}"
|
|
_USER="monitoring"
|
|
|
|
#grep:
|
|
# -F Use fixed text, no regexp which has to be interpreted
|
|
|
|
#cut:
|
|
# -d Delimiter, marker where to cut (here ;)
|
|
# -f Index of column to show (One based, so there is no -f0)
|
|
_RESULT="$(ssh -p "${_PORT}" "${_USER}"@"${_SERVER}" 'systemctl status nginx.service' | grep -F Active: | grep -F running | cut -d';' -f2)"
|
|
! [ -z "${_RESULT}" ] && echo "OK#UPTIME:${_RESULT}" || echo "FAIL"
|