From 6d872c59471bbca804c6a2daad6308c97095595b Mon Sep 17 00:00:00 2001 From: "Esteban Mackay Q." Date: Mon, 27 May 2024 21:54:05 -0500 Subject: [PATCH] Update update.sh --- update.sh | 77 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 31 deletions(-) diff --git a/update.sh b/update.sh index 9700966..887be99 100644 --- a/update.sh +++ b/update.sh @@ -710,7 +710,7 @@ sudo sed -i "s/COLOR_2 =.*/$variable5/g" /opt/FDMR-Monitor/fdmr-mon.cfg chmod +x /opt/FDMR-Monitor/sysinfo/* sh /opt/FDMR-Monitor/sysinfo/rrd-db.sh -systemctl daemon-reload +systemctl daemon-reload && ############## if systemctl status mariadb.service |grep inactive >/dev/null 2>&1 @@ -721,24 +721,30 @@ if systemctl status mariadb.service |grep disable >/dev/null 2>&1 then sudo systemctl enable mariadb.service fi -sudo systemctl disable fdmr_mon2.service -if ! systemctl status fdmr_mon.service | grep "service; enabled;" >/dev/null 2>&1; then - sudo systemctl enable fdmr_mon.service +if systemctl status fdmr_mon.service |grep "service; enabled;" >/dev/null 2>&1 +then + sudo systemctl stop fdmr_mon.service + sudo systemctl start fdmr_mon.service + (crontab -l; echo "* */24 * * * rm /opt/FDMR-Monitor/data/*") | awk '!x[$0]++' | crontab - + (crontab -l; echo "*/2 * * * * sh /opt/FDMR-Monitor/sysinfo/cpu.sh") | awk '!x[$0]++' | crontab - + (crontab -l; echo "*/5 * * * * sh /opt/FDMR-Monitor/sysinfo/graph.sh") | awk '!x[$0]++' | crontab - + (crontab -l | grep -v "rm /opt/FDMR-Monitor2/data/*") | crontab - + fi +if systemctl status fdmr_mon2.service |grep "service; enabled;" >/dev/null 2>&1 +then + sudo systemctl stop fdmr_mon2.service + sudo systemctl start fdmr_mon2.service + (crontab -l; echo "* */24 * * * rm /opt/FDMR-Monitor2/data/*") | awk '!x[$0]++' | crontab - + (crontab -l | grep -v "rm /opt/FDMR-Monitor/data/*") | crontab - + (crontab -l | grep -v "sh /opt/FDMR-Monitor/sysinfo/cpu.sh") | crontab - + (crontab -l | grep -v "sh /opt/FDMR-Monitor/sysinfo/graph.sh") | crontab - -############## +fi - systemctl daemon-reload && - systemctl start fdmr_mon.service - sh /opt/extra-2.sh -cronedit.sh '*/5 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/graph.sh' add && -cronedit.sh '*/2 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/cpu.sh' add && -cronedit.sh '*/5 * * * *' 'sh /etc/freedmr/hbmon/sysinfo/graph.sh' remove && -cronedit.sh '*/2 * * * *' 'sh /etc/freedmr/hbmon/sysinfo/cpu.sh' remove && -cronedit.sh '* */24 * * *' 'rm /etc/freedmr/hbmon/data/*' remove && -cronedit.sh '* */24 * * *' 'rm /opt/FDMR-Monitor/data/*' add && -cronedit.sh '* */24 * * *' 'rm /opt/FDMR-Monitor2/data/*' remove +############## + sh /opt/extra-2.sh if [ -f "/etc/nginx/sites-enabled/freedmr" ]; then mv /etc/nginx/sites-enabled/freedmr /etc/nginx/sites-enabled/adn @@ -930,28 +936,37 @@ cd /opt/FDMR-Monitor2 python3 mon_db.py --create && python3 mon_db.py --update +sudo systemctl daemon-reload && ##################################### +if systemctl status mariadb.service |grep inactive >/dev/null 2>&1 +then sudo systemctl start mariadb.service -sudo systemctl disable fdmr_mon.service -if ! systemctl status fdmr_mon2.service | grep "service; enabled;" >/dev/null 2>&1; then - sudo systemctl enable fdmr_mon2.service fi +if systemctl status mariadb.service |grep disable >/dev/null 2>&1 +then sudo systemctl enable mariadb.service -variable1=$(grep "Web-Dashboar-Port:" /opt/wdp | grep -Eo '[A.0-9]{1,9}') && -if [ -z "$variable1" ] -then variable1=80 +fi +if systemctl status fdmr_mon.service |grep "service; enabled;" >/dev/null 2>&1 +then + sudo systemctl stop fdmr_mon.service + sudo systemctl start fdmr_mon.service + (crontab -l; echo "* */24 * * * rm /opt/FDMR-Monitor/data/*") | awk '!x[$0]++' | crontab - + (crontab -l; echo "*/2 * * * * sh /opt/FDMR-Monitor/sysinfo/cpu.sh") | awk '!x[$0]++' | crontab - + (crontab -l; echo "*/5 * * * * sh /opt/FDMR-Monitor/sysinfo/graph.sh") | awk '!x[$0]++' | crontab - + (crontab -l | grep -v "rm /opt/FDMR-Monitor2/data/*") | crontab - -fi - systemctl start fdmr_mon2.service - sh /opt/extra-3.sh +fi +if systemctl status fdmr_mon2.service |grep "service; enabled;" >/dev/null 2>&1 +then + sudo systemctl stop fdmr_mon2.service + sudo systemctl start fdmr_mon2.service + (crontab -l; echo "* */24 * * * rm /opt/FDMR-Monitor2/data/*") | awk '!x[$0]++' | crontab - + (crontab -l | grep -v "rm /opt/FDMR-Monitor/data/*") | crontab - + (crontab -l | grep -v "sh /opt/FDMR-Monitor/sysinfo/cpu.sh") | crontab - + (crontab -l | grep -v "sh /opt/FDMR-Monitor/sysinfo/graph.sh") | crontab - -cronedit.sh '*/5 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/graph.sh' remove && -cronedit.sh '*/2 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/cpu.sh' remove && -cronedit.sh '*/5 * * * *' 'sh /etc/freedmr/hbmon/sysinfo/graph.sh' remove && -cronedit.sh '*/2 * * * *' 'sh /etc/freedmr/hbmon/sysinfo/cpu.sh' remove && -cronedit.sh '* */24 * * *' 'rm /etc/freedmr/hbmon/data/*' remove && -cronedit.sh '* */24 * * *' 'rm /opt/FDMR-Monitor/data/*' remove && -cronedit.sh '* */24 * * *' 'rm /opt/FDMR-Monitor2/data/*' add +fi +sh /opt/extra-3.sh if [ -f "/etc/nginx/sites-enabled/freedmr" ]; then mv /etc/nginx/sites-enabled/freedmr /etc/nginx/sites-enabled/adn