From 0af188ec6d12f42b072f3f6a5f6139dcc055bc25 Mon Sep 17 00:00:00 2001 From: Ramil Valitov Date: Sat, 18 Jan 2020 23:04:28 +0300 Subject: [PATCH] [add] detect current user --- zabbix/zabbix_php_fpm_discovery.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zabbix/zabbix_php_fpm_discovery.sh b/zabbix/zabbix_php_fpm_discovery.sh index 54463b4..8d03f4c 100644 --- a/zabbix/zabbix_php_fpm_discovery.sh +++ b/zabbix/zabbix_php_fpm_discovery.sh @@ -15,6 +15,7 @@ S_CAT=`type -P cat` S_BASH=`type -P bash` S_ECHO=`type -P echo` S_PRINTF=`type -P printf` +S_WHOAMI=`type -P whoami` if [[ ! -f $S_PS ]]; then ${S_ECHO} "Utility 'ps' not found. Please, install it first." @@ -60,9 +61,14 @@ if [[ ! -f ${S_PRINTF} ]]; then ${S_ECHO} "Utility 'printf' not found. Please, install it first." exit 1 fi +if [[ ! -f ${S_WHOAMI} ]]; then + ${S_ECHO} "Utility 'whoami' not found. Please, install it first." + exit 1 +fi STATUS_PATH="/php-fpm-status" DEBUG_MODE="" +ACTIVE_USER=`${S_WHOAMI}` # Prints a string on screen. Works only if debug mode is enabled. function PrintDebug(){ @@ -178,6 +184,7 @@ for ARG in "$@"; do PrintDebug "Argument $ARG is unknown and skipped" fi done +PrintDebug "Current user is $ACTIVE_USER" PrintDebug "Status path to be used: $STATUS_PATH" LOCAL_DIR=`${S_DIRNAME} $0`