3
0
mirror of https://github.com/rvalitov/zabbix-php-fpm.git synced 2023-11-05 03:30:27 +01:00

[add] detect current user

This commit is contained in:
Ramil Valitov 2020-01-18 23:04:28 +03:00
parent 68e5a4d377
commit 0af188ec6d
No known key found for this signature in database
GPG Key ID: 645768E8FD0E18C7

View File

@ -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`