diff --git a/conf.sh b/conf.sh index 48bfc98..662a5cd 100644 --- a/conf.sh +++ b/conf.sh @@ -33,7 +33,7 @@ fi systemctl stop monit curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/conf/monit/monitrc -o $monitconf -curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/conf/monit/monitwebsocket -o /conf/monit/websocket +curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/conf/monit/monitwebsocket -o /etc/monit/websocket touch /opt/MonitNotify.sh chmod +x /opt/MonitNotify.sh @@ -58,7 +58,7 @@ fi if echo "$SysServiceList" | grep -Fq "$monitMysqlserv"; then curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/conf/monit/mysql.conf -o /etc/monit/conf.d/mysql.conf - sed -i "s/MYSQLserv/$monitMysqlservice/g" /etc/monit/conf.d/mysql.conf + sed -i "s/MYSQLserv/$monitMysqlserv/g" /etc/monit/conf.d/mysql.conf fi if echo "$SysServiceList" | grep -Fq 'nginx'; then @@ -67,10 +67,11 @@ fi if echo "$SysServiceList" | grep -Fq "$phpFPMService" && test ! -z "$phpFPMService"; then curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/conf/monit/php-fpm.conf -o /etc/monit/conf.d/php"$phpver".conf - sed -i "s/PHPpid/$monitPhpPid/g" /etc/monit/conf.d/php"$phpver".conf - sed -i "s/PHPpro/$monitPhpPro/g" /etc/monit/conf.d/php"$phpver".conf + sed -i "s#PHPpid#$monitPhpPid#g" /etc/monit/conf.d/php"$phpver".conf + sed -i "s#PHPpro#$monitPhpPro#g" /etc/monit/conf.d/php"$phpver".conf + sed -i "s#PHPsock#$monitPhpSock#g" /etc/monit/conf.d/php"$phpver".conf sed -i "s/PHPsrv/$phpFPMService/g" /etc/monit/conf.d/php"$phpver".conf - sed -i "s/PHPsock/$monitPhpSock/g" /etc/monit/conf.d/php"$phpver".conf + sed -i "s/PHPver/$phpver/g" /etc/monit/conf.d/php"$phpver".conf fi if echo "$SysServiceList" | grep -Fq "$apacheService" && test ! -z "$apacheService"; then diff --git a/conf/monit/apache.conf b/conf/monit/apache.conf index 47988ef..7fe2c10 100644 --- a/conf/monit/apache.conf +++ b/conf/monit/apache.conf @@ -1,6 +1,6 @@ check process APApro with pidfile /var/run/APAserv/APAserv.pid - start program = "/usr/bin/systemctl start APAserv" - stop program = "/usr/bin/systemctl stop APAserv" + start program = "/bin/systemctl start APAserv" + stop program = "/bin/systemctl stop APAserv" if not exist for 1 cycles then restart if not exist for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: Apache'" else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: Apache'" diff --git a/conf/monit/fail2ban.conf b/conf/monit/fail2ban.conf index 0fb3b23..c8d47cd 100644 --- a/conf/monit/fail2ban.conf +++ b/conf/monit/fail2ban.conf @@ -1,6 +1,6 @@ check process fail2ban with pidfile /var/run/fail2ban/fail2ban.pid - start program = "/usr/bin/systemctl start fail2ban" - stop program = "/usr/bin/systemctl stop fail2ban" + start program = "/bin/systemctl start fail2ban" + stop program = "/bin/systemctl stop fail2ban" if failed unixsocket /var/run/fail2ban/fail2ban.sock then restart if failed unixsocket /var/run/fail2ban/fail2ban.sock for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: Fail2Ban Socket'" else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: Fail2Ban Socket'" diff --git a/conf/monit/mysql.conf b/conf/monit/mysql.conf index 34b9cc9..364dc82 100644 --- a/conf/monit/mysql.conf +++ b/conf/monit/mysql.conf @@ -1,9 +1,9 @@ check process mysqld with pidfile /var/run/mysqld/mysqld.pid - start program = "/usr/bin/systemctl start MYSQLserv" - stop program = "/usr/bin/systemctl stop MYSQLserv" + start program = "/bin/systemctl start MYSQLserv" + stop program = "/bin/systemctl stop MYSQLserv" if failed unixsocket /var/run/mysqld/mysqld.sock protocol mysql for 2 times within 5 cycles then restart if failed unixsocket /var/run/mysqld/mysqld.sock protocol mysql for 4 times within 5 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: MySQL Socket'" - else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: MySQL Socket" + else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: MySQL Socket'" if not exist for 1 cycles then restart if not exist for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: MySQL service'" diff --git a/conf/monit/nginx.conf b/conf/monit/nginx.conf index 1d546cd..5e69400 100644 --- a/conf/monit/nginx.conf +++ b/conf/monit/nginx.conf @@ -1,6 +1,6 @@ check process nginx with pidfile /var/run/nginx.pid - start program = "/usr/bin/systemctl start nginx" - stop program = "/usr/bin/systemctl stop nginx" + start program = "/bin/systemctl start nginx" + stop program = "/bin/systemctl stop nginx" if not exist for 1 cycles then restart if not exist for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: Nginx" else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: Nginx'" diff --git a/conf/monit/php-fpm.conf b/conf/monit/php-fpm.conf index b65bf41..fd7bfbc 100644 --- a/conf/monit/php-fpm.conf +++ b/conf/monit/php-fpm.conf @@ -1,8 +1,8 @@ check process PHPpro with pidfile PHPpid - start program = "/usr/bin/systemctl start PHPsrv" - stop program = "/usr/bin/systemctl stop PHPsrv" + start program = "/bin/systemctl start PHPsrv" + stop program = "/bin/systemctl stop PHPsrv" if failed unixsocket PHPsock then restart - if failed unixsocket PHPsockfor 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: phpPHPver-fpm socket'" + if failed unixsocket PHPsock for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: phpPHPver-fpm socket'" else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: phpPHPver-fpm socket'" if not exist for 1 cycles then restart diff --git a/conf/monit/sshd.conf b/conf/monit/sshd.conf index b01203b..2bd9445 100644 --- a/conf/monit/sshd.conf +++ b/conf/monit/sshd.conf @@ -1,6 +1,6 @@ check process sshd with pidfile /var/run/sshd.pid - start program = "/usr/bin/systemctl start sshd" - stop program = "/usr/bin/systemctl stop sshd" + start program = "/bin/systemctl start sshd" + stop program = "/bin/systemctl stop sshd" if not exist for 1 cycles then restart if not exist for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: SSHD'" else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: SSHD'"