From cfb4602bedcb9833c04bd047695e46cbf639f530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lecour?= Date: Fri, 22 Mar 2019 20:30:08 +0100 Subject: [PATCH] extract variable --- evocheck.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/evocheck.sh b/evocheck.sh index 33ef7fa..0870bbb 100755 --- a/evocheck.sh +++ b/evocheck.sh @@ -984,10 +984,11 @@ if is_debian; then if [ "$IS_MYSQLNRPE" = 1 ]; then if is_debian_stretch && is_installed mariadb-server; then - { test -f ~nagios/.my.cnf \ - && [ "$(stat -c %U ~nagios/.my.cnf)" = "nagios" ] \ - && [ "$(stat -c %a ~nagios/.my.cnf)" = "600" ] \ - && grep -q -F "command[check_mysql]=/usr/lib/nagios/plugins/check_mysql -H localhost -f ~nagios/.my.cnf"; + nagios_file="~nagios/.my.cnf" + { test -f $nagios_file \ + && [ "$(stat -c %U $nagios_file)" = "nagios" ] \ + && [ "$(stat -c %a $nagios_file)" = "600" ] \ + && grep -q -F "command[check_mysql]=/usr/lib/nagios/plugins/check_mysql -H localhost -f $nagios_file"; } || failed "IS_MYSQLNRPE" fi fi