This commit is contained in:
Esteban Mackay Q 2023-10-28 00:20:51 -05:00
parent edf7a57918
commit b2ba1f083d
3 changed files with 83 additions and 55 deletions

View File

@ -13,6 +13,17 @@ then
rm -r /var/www/dvs
fi
mkdir /var/www/dvs
if ! [ -f "/opt/wdp3" ]
then
sudo cat > /opt/wdp3 <<- "EOFX"
##########################################
# Select number port, DVSwitch Dashboard #
##########################################
Web-Dashboar-Port: 80
EOFX
fi
sudo wget -O /var/www/dvs/DVS-Dash.zip usrp.duckdns.org/DVS_Dashboard/DVS.zip &&
cd /var/www/dvs
sudo unzip -o DVS-Dash.zip &&
@ -43,8 +54,18 @@ if ! sudo systemctl status webproxy.service |grep "service; enabled;" >/dev/null
sudo systemctl enable webproxy.service
fi
if ! systemctl status webproxy.service |grep "Active: active" >/dev/null 2>&1
then sudo systemctl restart webproxy.service
then
sudo systemctl stop webproxy.service
sudo systemctl start webproxy.service
fi
if ! sudo systemctl status monit.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable monit.service
fi
if ! systemctl status monit.service |grep "Active: active" >/dev/null 2>&1
then
sudo systemctl stop monit.service
sudo systemctl start monit.service
fi
#
if [ ! -f "/lib/systemd/system/http.server-dvs.service" ]
@ -67,12 +88,23 @@ WantedBy=multi-user.target
EOF
#
systemctl daemon-reload
fi
if sudo systemctl status lighttpd.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl disable lighttpd.service
sudo systemctl stop lighttpd.service
sudo systemctl enable http.server-dvs.service
sudo systemctl start http.server-dvs.service
fi
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp3 | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
then variable80=80
fi
sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable80 -t \/var\/www\/dvs\//g" /lib/systemd/system/http.server-dvs.service &&
systemctl daemon-reload &&
if sudo systemctl status http.server-dvs.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl stop http.server-dvs.service
sudo systemctl start http.server-dvs.service
fi

View File

@ -72,10 +72,9 @@ rm /var/log/mmdvm/*;;
3)
sudo /usr/local/dvs/dvs ;;
4)
if sudo systemctl status http.server-dvs.service |grep active >/dev/null 2>&1
then
sudo systemctl stop http.server-dvs.service
fi
sudo systemctl stop monit.service
sudo systemctl stop webproxy.service
nano /opt/wdp3 &&
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp3 | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
@ -89,19 +88,25 @@ if sudo netstat -tuln | grep -q "0.0.0.0:$variable80 "; then
else
if sudo systemctl status http.server-dvs.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl start http.server-dvs.service
sudo systemctl start http.server-dvs.service
if sudo systemctl status webproxy.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl start webproxy.service
if sudo systemctl status monit.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl start monit.service
fi
fi
fi
fi ;;
5)
cp /opt/index-dvs.txt /var/www/dvs/index.php
if sudo systemctl status http.server-dvs.service |grep "service; enabled;" >/dev/null 2>&1
then
cp /opt/index-dvs.txt /var/www/dvs/index.php &&
sudo systemctl disable http.server-dvs.service
fi
if sudo systemctl status http.server-dvs.service |grep active >/dev/null 2>&1
then
sudo systemctl disable monit.service
sudo systemctl disable webproxy.service
sudo systemctl stop http.server-dvs.service
fi
sudo systemctl stop monit.service
sudo systemctl stop webproxy.service
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp3 | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
then variable80=80
@ -119,8 +124,12 @@ else
if ! sudo systemctl status webproxy.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable webproxy.service
sudo systemctl stop webproxy.service
sudo systemctl start webproxy.service
if ! sudo systemctl status monit.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable monit.service
sudo systemctl start monit.service
fi
fi
fi
fi ;;
@ -129,14 +138,12 @@ sudo systemctl stop http.server-dvs.service && sudo systemctl disable http.serve
7)
cp /opt/index-dvs.txt /var/www/dvs/index.php &&
bash -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/dvs-nb.sh)" &&
if sudo systemctl status http.server-dvs.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl disable http.server-dvs.service
fi
if sudo systemctl status http.server-dvs.service |grep active >/dev/null 2>&1
then
sudo systemctl disable monit.service
sudo systemctl disable webproxy.service
sudo systemctl stop http.server-dvs.service
fi
sudo systemctl stop monit.service
sudo systemctl stop webproxy.service
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp3 | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
then variable80=80
@ -150,13 +157,16 @@ else
if ! sudo systemctl status http.server-dvs.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable http.server-dvs.service
sudo systemctl stop http.server-dvs.service
sudo systemctl start http.server-dvs.service
if ! sudo systemctl status webproxy.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable webproxy.service
sudo systemctl stop webproxy.service
sudo systemctl start webproxy.service
if ! sudo systemctl status monit.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable monit.service
sudo systemctl start monit.service
fi
fi
fi
fi ;;
@ -233,10 +243,9 @@ sudo /usr/local/dvs/dvs ;;
4)
sudo /usr/local/dvs/dvsmu ;;
5)
if sudo systemctl status http.server-dvs.service |grep active >/dev/null 2>&1
then
sudo systemctl stop http.server-dvs.service
fi
sudo systemctl stop monit.service
sudo systemctl stop webproxy.service
nano /opt/wdp3 &&
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp3 | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
@ -250,31 +259,25 @@ if sudo netstat -tuln | grep -q "0.0.0.0:$variable80 "; then
else
if sudo systemctl status http.server-dvs.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl start http.server-dvs.service
if ! sudo systemctl status webproxy.service |grep "service; enabled;" >/dev/null 2>&1
sudo systemctl start http.server-dvs.service
if sudo systemctl status webproxy.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable webproxy.service
sudo systemctl stop webproxy.service
sudo systemctl start webproxy.service
if ! sudo systemctl status monit.service |grep "service; enabled;" >/dev/null 2>&1
if sudo systemctl status monit.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable monit.service
sudo systemctl stop monit.service
sudo systemctl start monit.service
fi
fi
fi
fi ;;
6)
cp /opt/index-dvs.txt /var/www/dvs/index.php
if sudo systemctl status http.server-dvs.service |grep "service; enabled;" >/dev/null 2>&1
then
cp /opt/index-dvs.txt /var/www/dvs/index.php &&
sudo systemctl disable http.server-dvs.service
fi
if sudo systemctl status http.server-dvs.service |grep active >/dev/null 2>&1
then
sudo systemctl disable monit.service
sudo systemctl disable webproxy.service
sudo systemctl stop http.server-dvs.service
fi
sudo systemctl stop monit.service
sudo systemctl stop webproxy.service
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp3 | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
then variable80=80
@ -288,17 +291,14 @@ else
if ! sudo systemctl status http.server-dvs.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable http.server-dvs.service
sudo systemctl stop http.server-dvs.service
sudo systemctl start http.server-dvs.service
if ! sudo systemctl status webproxy.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable webproxy.service
sudo systemctl stop webproxy.service
sudo systemctl start webproxy.service
if ! sudo systemctl status monit.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable monit.service
sudo systemctl stop monit.service
sudo systemctl start monit.service
fi
fi
@ -309,14 +309,12 @@ sudo systemctl stop http.server-dvs.service && sudo systemctl disable http.serve
8)
cp /opt/index-dvs.txt /var/www/dvs/index.php &&
bash -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/dvs-nb.sh)" &&
if sudo systemctl status http.server-dvs.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl disable http.server-dvs.service
fi
if sudo systemctl status http.server-dvs.service |grep active >/dev/null 2>&1
then
sudo systemctl disable monit.service
sudo systemctl disable webproxy.service
sudo systemctl stop http.server-dvs.service
fi
sudo systemctl stop monit.service
sudo systemctl stop webproxy.service
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp3 | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
then variable80=80
@ -330,17 +328,14 @@ else
if ! sudo systemctl status http.server-dvs.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable http.server-dvs.service
sudo systemctl stop http.server-dvs.service
sudo systemctl start http.server-dvs.service
if ! sudo systemctl status webproxy.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable webproxy.service
sudo systemctl stop webproxy.service
sudo systemctl start webproxy.service
if ! sudo systemctl status monit.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable monit.service
sudo systemctl stop monit.service
sudo systemctl start monit.service
fi
fi

View File

@ -77,7 +77,8 @@ else
exit 0
fi;;
3)
bash -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/service/service.sh)" ;;
bash -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/service/service.sh)" &&
bash -c "$(curl -fsSL https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-dvs)" ;;
4)
break
;;