updated systemctl path, fixed mysql & php conf

This commit is contained in:
2021-01-08 15:03:15 +01:00
parent cedf566f74
commit fc90bb59fe
7 changed files with 20 additions and 19 deletions

11
conf.sh
View File

@@ -33,7 +33,7 @@ fi
systemctl stop monit 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/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 touch /opt/MonitNotify.sh
chmod +x /opt/MonitNotify.sh chmod +x /opt/MonitNotify.sh
@@ -58,7 +58,7 @@ fi
if echo "$SysServiceList" | grep -Fq "$monitMysqlserv"; then 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 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 fi
if echo "$SysServiceList" | grep -Fq 'nginx'; then if echo "$SysServiceList" | grep -Fq 'nginx'; then
@@ -67,10 +67,11 @@ fi
if echo "$SysServiceList" | grep -Fq "$phpFPMService" && test ! -z "$phpFPMService"; then 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 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#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#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/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 fi
if echo "$SysServiceList" | grep -Fq "$apacheService" && test ! -z "$apacheService"; then if echo "$SysServiceList" | grep -Fq "$apacheService" && test ! -z "$apacheService"; then

View File

@@ -1,6 +1,6 @@
check process APApro with pidfile /var/run/APAserv/APAserv.pid check process APApro with pidfile /var/run/APAserv/APAserv.pid
start program = "/usr/bin/systemctl start APAserv" start program = "/bin/systemctl start APAserv"
stop program = "/usr/bin/systemctl stop APAserv" stop program = "/bin/systemctl stop APAserv"
if not exist for 1 cycles then restart if not exist for 1 cycles then restart
if not exist for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: Apache'" 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'" else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: Apache'"

View File

@@ -1,6 +1,6 @@
check process fail2ban with pidfile /var/run/fail2ban/fail2ban.pid check process fail2ban with pidfile /var/run/fail2ban/fail2ban.pid
start program = "/usr/bin/systemctl start fail2ban" start program = "/bin/systemctl start fail2ban"
stop program = "/usr/bin/systemctl stop 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 then restart
if failed unixsocket /var/run/fail2ban/fail2ban.sock for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: Fail2Ban Socket'" 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'" else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: Fail2Ban Socket'"

View File

@@ -1,9 +1,9 @@
check process mysqld with pidfile /var/run/mysqld/mysqld.pid check process mysqld with pidfile /var/run/mysqld/mysqld.pid
start program = "/usr/bin/systemctl start MYSQLserv" start program = "/bin/systemctl start MYSQLserv"
stop program = "/usr/bin/systemctl stop 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 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'" 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 1 cycles then restart
if not exist for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: MySQL service'" if not exist for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: MySQL service'"

View File

@@ -1,6 +1,6 @@
check process nginx with pidfile /var/run/nginx.pid check process nginx with pidfile /var/run/nginx.pid
start program = "/usr/bin/systemctl start nginx" start program = "/bin/systemctl start nginx"
stop program = "/usr/bin/systemctl stop nginx" stop program = "/bin/systemctl stop nginx"
if not exist for 1 cycles then restart if not exist for 1 cycles then restart
if not exist for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: Nginx" 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'" else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: Nginx'"

View File

@@ -1,6 +1,6 @@
check process PHPpro with pidfile PHPpid check process PHPpro with pidfile PHPpid
start program = "/usr/bin/systemctl start PHPsrv" start program = "/bin/systemctl start PHPsrv"
stop program = "/usr/bin/systemctl stop PHPsrv" stop program = "/bin/systemctl stop PHPsrv"
if failed unixsocket PHPsock then restart if failed unixsocket PHPsock then restart
if failed unixsocket PHPsock for 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'" else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: phpPHPver-fpm socket'"

View File

@@ -1,6 +1,6 @@
check process sshd with pidfile /var/run/sshd.pid check process sshd with pidfile /var/run/sshd.pid
start program = "/usr/bin/systemctl start sshd" start program = "/bin/systemctl start sshd"
stop program = "/usr/bin/systemctl stop sshd" stop program = "/bin/systemctl stop sshd"
if not exist for 1 cycles then restart if not exist for 1 cycles then restart
if not exist for 3 cycles then exec "/opt/MonitNotify.sh 'SRV-WARN: SSHD'" 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'" else if recovered then exec "/opt/MonitNotify.sh 'SRV-OK: SSHD'"