From f354d0b6990be2ec8841b133901b3ff3557089fb Mon Sep 17 00:00:00 2001 From: Bruno 21 Date: Thu, 7 Nov 2019 21:41:35 +0100 Subject: [PATCH] homebrew.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Notification si php.ini a été modifié --- plugins.d/homebrew.sh | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/plugins.d/homebrew.sh b/plugins.d/homebrew.sh index 887cb7d..cdfe122 100755 --- a/plugins.d/homebrew.sh +++ b/plugins.d/homebrew.sh @@ -26,8 +26,9 @@ no_distract=false notification() { sound="Basso" - title="Attention !!!" - message="$1 was modified in the last 5 minutes" + title="Homebrew" + #subtitle="Attention !!!" + message="$1" image="error.png" if [[ "$OSTYPE" == "darwin"* ]] && [ -x "$(command -v terminal-notifier)" ]; then @@ -82,6 +83,9 @@ if [ -n "$upd3" ]; then echo "" done fi + + touch /tmp/checkpoint + if [ "$no_distract" = false ]; then a=$(echo -e "Do you wanna run \033[1mbrew upgrade "$upd3"\033[0m? (y/n)") @@ -160,21 +164,42 @@ if [ -n "$latest" ] && [ "$no_distract" = false ]; then fi echo "" -echo "🍺 ️The Doc is checking that everything is ok." -brew doctor -brew missing -echo "" - # 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) -[ ! -z $test ] && echo -e "\033[1;31m❗️ ️$name was modified in the last 5 minutes\033[0m" -[ ! -z $test ] && notification $dir +[ ! -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 + # file modified since it was last read + #if [ -N /usr/local/etc/php/$php/php.ini ]; then echo "modified"; fi + + 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" + + [ ! -z $php_modified ] && echo -e "\033[1;31m❗️ ️$notif2\033[0m" + [ ! -z $php_modified ] && notification "$notif2" + +done +echo "" + +# Doctor + +echo "🍺 ️The Doc is checking that everything is ok." +brew doctor +brew missing +echo "" # Homebrew 2.0.0+ run a cleanup every 30 days