From 1d4f9a85449325b414fb26ad767cc67b6754e267 Mon Sep 17 00:00:00 2001 From: Ramil Valitov Date: Sat, 18 Jan 2020 23:04:53 +0300 Subject: [PATCH] [add] check if cache file is writeable --- zabbix/zabbix_php_fpm_discovery.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zabbix/zabbix_php_fpm_discovery.sh b/zabbix/zabbix_php_fpm_discovery.sh index 8d03f4c..95950d1 100644 --- a/zabbix/zabbix_php_fpm_discovery.sh +++ b/zabbix/zabbix_php_fpm_discovery.sh @@ -322,6 +322,11 @@ do fi done +if [[ -f ${CACHE_FILE} ]] && [[ ! -w ${CACHE_FILE} ]]; then + ${S_ECHO} "Error: write permission is not granted to user $ACTIVE_USER for cache file $CACHE_FILE" + exit 1 +fi + PrintDebug "Saving new cache file $CACHE_FILE..." ${S_PRINTF} "%s\n" "${NEW_CACHE[@]}" > ${CACHE_FILE}