From 9f9257bb1820fc27ec29c87b13344b80f32e44b7 Mon Sep 17 00:00:00 2001 From: RaspbianProyect by HP3ICC Date: Sat, 29 Jul 2023 05:10:36 +0000 Subject: [PATCH] Replace update.sh --- update.sh | 92 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 33 deletions(-) diff --git a/update.sh b/update.sh index db35887..5a3123e 100644 --- a/update.sh +++ b/update.sh @@ -517,6 +517,22 @@ Restart=on-failure [Install] WantedBy=multi-user.target +EOF +cat > /lib/systemd/system/http.server-fdmr.service <<- "EOF" +[Unit] +Description=PHP http.server.fdmr +After=network.target + +[Service] +#User=root +#ExecStartPre=/bin/sleep 30 +# Modify for different other port +ExecStart=php -S 0.0.0.0:80 -t /var/www/fdmr/ +Restart=on-failure + +[Install] +WantedBy=multi-user.target + EOF # if [ -d "/var/www/fdmr" ] @@ -560,22 +576,6 @@ sudo sed -i "s/test/selfcare/g" /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg sudo sed -i "s/PRIVATE_NETWORK = True/PRIVATE_NETWORK = False/g" /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg sudo sed -i "s/FILES_PATH =.*/FILES_PATH = \/opt\/FDMR-Monitor\/data/g" /opt/FDMR-Monitor/fdmr-mon_SAMPLE.cfg -cat > /lib/systemd/system/http.server-fdmr.service <<- "EOFH" -[Unit] -Description=PHP http.server.fdmr -After=network.target - -[Service] -#User=root -#ExecStartPre=/bin/sleep 30 -# Modify for different other port -ExecStart=php -S 0.0.0.0:80 -t /var/www/fdmr/ -Restart=on-failure - -[Install] -WantedBy=multi-user.target -EOFH - cd /opt/FDMR-Monitor/ #sudo rm /opt/FDMR-Monitor/install.sh ################ @@ -1012,6 +1012,49 @@ if systemctl status proxy.service |grep "active" >/dev/null 2>&1 then sudo systemctl stop proxy.service fi +############################################################## +# service update +############################################################ + +cat > /lib/systemd/system/fdmr_mon2.service <<- "EOF" +[Unit] +Description=FDMR Monitor2 +# To make the network-online.target available +# systemctl enable systemd-networkd-wait-online.service +#After=network-online.target syslog.target +#Wants=network-online.target + +[Service] +#User=root +#Type=simple +#Restart=always +#RestartSec=3 +#StandardOutput=null +WorkingDirectory=/opt/FDMR-Monitor2 +ExecStart=python3 /opt/FDMR-Monitor2/monitor.py +#Restart=on-abort +Restart=on-failure + +[Install] +WantedBy=multi-user.target + +EOF +cat > /lib/systemd/system/http.server-fdmr2.service <<- "EOFH" +[Unit] +Description=PHP http.server.fdmr2 +After=network.target + +[Service] +#User=root +#ExecStartPre=/bin/sleep 30 +# Modify for different other port +ExecStart=php -S 0.0.0.0:80 -t /var/www/fdmr2/ +Restart=on-failure + +[Install] +WantedBy=multi-user.target +EOFH + cd / if [ -d "/var/www/fdmr2" ] then @@ -1029,21 +1072,6 @@ if [ ! -d "/var/www/fdmr2" ] then mkdir -p /var/www/fdmr2 fi -cat > /lib/systemd/system/http.server-fdmr2.service <<- "EOFHI" -[Unit] -Description=PHP http.server.fdmr2 -After=network.target - -[Service] -#User=root -#ExecStartPre=/bin/sleep 30 -# Modify for different other port -ExecStart=php -S 0.0.0.0:80 -t /var/www/fdmr2/ -Restart=on-failure - -[Install] -WantedBy=multi-user.target -EOFI cd /opt sudo git clone https://github.com/CS8ABG/FDMR-Monitor.git /opt/FDMR-Monitor2 @@ -1103,7 +1131,6 @@ mysql -u "root" "selfcare" -e "DROP TABLE IF EXISTS tg_count;" 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 @@ -1183,7 +1210,6 @@ cronjob_editor "$1" "$2" "$3" EOFC1 sudo chmod +x /usr/local/bin/cronedit.sh - ########################################## End Update Files ############################################################## sudo systemctl daemon-reload