From 6b4dfb2abbe892c51b37249c85903fed73dc8c4d Mon Sep 17 00:00:00 2001 From: Bruno 21 Date: Mon, 4 Jan 2021 18:57:50 +0100 Subject: [PATCH] homebrew.sh Feature: +test if Apache conf file has been modified by Homebrew --- plugins.d/homebrew.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/plugins.d/homebrew.sh b/plugins.d/homebrew.sh index 55bee51..a614b29 100755 --- a/plugins.d/homebrew.sh +++ b/plugins.d/homebrew.sh @@ -390,6 +390,48 @@ if [ -n "$casks_latest_not_pinned" ] && [ "$latest" == true ]; then fi fi + +############################################################### +### Test if Apache conf file has been modified by Homebrew ### +### (Apache, PHP or Python updates) ### +############################################################### + +v_apa=$(httpd -V | grep 'SERVER_CONFIG_FILE') +conf_apa=$(echo "$v_apa" | awk -F "\"" '{print $2}') +dir=$(dirname $conf_apa) +name=$(basename $conf_apa) +notif1="$dir has been modified in the last 5 minutes" + +test=$(find $dir -name "$name" -mmin -5 -maxdepth 1) + +echo "$test" + +[ ! -z $test ] && echo -e "\033[1;31m❗️ ️$notif1\033[0m" +[ ! -z $test ] && notification "$notif1" + +# Test if PHP.ini file has been modified by Homebrew (PECL) + +php_versions=$(ls /usr/local/etc/php/) +for php in $php_versions +do + if [ -n "$upd_pkg" ]; then + + # file modified since it was last read + + php_modified=$(find /usr/local/etc/php/$php/ -name php.ini -newer /tmp/checkpoint) + php_ini=/usr/local/etc/php/$php/php.ini + notif2="$php_ini has been modified" + + echo "$php_modified" + + [ ! -z $php_modified ] && echo -e "\033[1;31m❗️ ️$notif2\033[0m" + [ ! -z $php_modified ] && notification "$notif2" + + fi +done +echo "" + + ############## ### Doctor ### ##############