Update fdmr.sh

This commit is contained in:
Esteban Mackay Q 2023-07-25 13:26:22 -05:00
parent 884adb5fc2
commit cd49138b6a
1 changed files with 37 additions and 48 deletions

View File

@ -1,7 +1,7 @@
#!/bin/sh
if [[ $EUID -ne 0 ]]; then
whiptail --title "FDMR+" --msgbox "Debe ejecutar este script como usuario ROOT" 0 50
exit 0
whiptail --title "FDMR+" --msgbox "Debe ejecutar este script como usuario ROOT" 0 50
exit 0
fi
######################################################################################################################
(crontab -l; echo "* */1 * * * sync ; echo 3 > /proc/sys/vm/drop_caches >/dev/null 2>&1")|awk '!x[$0]++'|crontab -
@ -94,20 +94,6 @@ then
else
echo "file not found"
fi
if [ -d "/var/www/fdmr" ];
then
rm -r /var/www/fdmr/
#echo "found file"
else
echo "file not found"
fi
if [ -d "/opt/FDMR-Monitor" ]
then
rm -r /opt/FDMR-Monitor
#echo "found file"
fi
if [ -f "/opt/FreeDMR/config/FreeDMR.cfg" ];
then
@ -120,19 +106,34 @@ if [ -z "$variable" ]
then variable=0000
fi
if [ -d "/opt/FreeDMR" ]
then
rm -r /opt/FreeDMR
#echo "found file"
###################################
fi
if [ -d "/var/log/FreeDMR" ]
then
rm -r /var/log/FreeDMR
#echo "found file"
sudo rm -rf /var/log/FreeDMR
fi
mkdir /var/log/FreeDMR
if [ -f "/bin/menu-fdmr" ];
if [ -d "/opt/FreeDMR" ]
then
sudo rm -rf /opt/FreeDMR
fi
if [ -d "/var/www/fdmr2" ]
then
sudo rm -rf /var/www/fdmr2
fi
if [ -d "/opt/FDMR-Monitor2" ]
then
sudo rm -rf /opt/FDMR-Monitor2
fi
if [ -d "/var/www/fdmr" ]
then
sudo rm -rf /var/www/fdmr
fi
if [ -d "/opt/FDMR-Monitor" ]
then
sudo rm -rf /opt/FDMR-Monitor
fi
###############################
if [ -f "/bin/menu-fdmr" ];
then
rm /bin/menu-fdmr
#echo "found file"
@ -141,35 +142,21 @@ else
fi
########################
if [ -d "/var/www" ]
if [ ! -d "/var/www" ]
then
echo "found file"
else
mkdir /var/www
mkdir -p /var/www
fi
if [ -d "/var/www/fdmr" ]
if [ ! -d "/var/www/fdmr" ]
then
echo "found file"
else
mkdir /var/www/fdmr
mkdir -p /var/www/fdmr
fi
if [ -d "/opt/FDMR-Monitor2" ]
if [ ! -d "/var/www/fdmr2" ]
then
rm -r /opt/FDMR-Monitor2
#echo "found file"
mkdir -p /var/www/fdmr2
fi
if [ -d "/var/www/fdmr2" ]
if [ ! -d "/var/log/FreeDMR" ]
then
rm -r /var/www/fdmr2
#echo "found file"
fi
if [ -d "/var/www/fdmr2" ]
then
echo "found file"
else
mkdir /var/www/fdmr2
mkdir -p /var/log/FreeDMR
fi
########################
if [ -f "/opt/obp.txt" ]
@ -917,6 +904,8 @@ cd /opt/FDMR-Monitor2
sudo git checkout Self_Service
pip3 install -r requirements.txt
sed -i '72d' /opt/FDMR-Monitor2/html/include/navbar.php
sed '69 a \ <option value="es">ES</option>' -i /opt/FDMR-Monitor2/html/include/navbar.php
sed -i "s/root/emqte1/g" /opt/FDMR-Monitor2/fdmr-mon_SAMPLE.cfg
sed -i "s/test/selfcare/g" /opt/FDMR-Monitor2/fdmr-mon_SAMPLE.cfg
sed -i "s/PRIVATE_NETWORK = True/PRIVATE_NETWORK = False/g" /opt/FDMR-Monitor2/fdmr-mon_SAMPLE.cfg
@ -961,7 +950,7 @@ Restart=on-failure
WantedBy=multi-user.target
EOF
#############################
#########################################################
sudo systemctl daemon-reload
cronedit.sh '*/5 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/graph.sh' remove
cronedit.sh '*/2 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/cpu.sh' remove