This commit is contained in:
2023-03-07 20:52:40 -06:00
parent b8c5998e8b
commit 1d95a7630f
2 changed files with 17 additions and 13 deletions

View File

@@ -43,9 +43,6 @@ MMSTART(){
SENDNOTICE "Starting Media Management Systems" "" SENDNOTICE "Starting Media Management Systems" ""
echo "$(date) - Starting Media Management system - (fresh start)" >> $logfile echo "$(date) - Starting Media Management system - (fresh start)" >> $logfile
echo -e "${idsCL[LightCyan]}Fresh startup${idsCL[Default]}" echo -e "${idsCL[LightCyan]}Fresh startup${idsCL[Default]}"
if [ -f ${MMFOLDER}/mm.stop.checking ]; then
rm -f ${MMFOLDER}/mm.stop*
fi
elif [ "${1}" = "check" ] && [ "$(ip link | grep "${VPN_INTERFACE}")" = "" ] && [ -f ${MMFOLDER}/mm.vpn* ]; then elif [ "${1}" = "check" ] && [ "$(ip link | grep "${VPN_INTERFACE}")" = "" ] && [ -f ${MMFOLDER}/mm.vpn* ]; then
GOFORSTART=true; GOFORSTART=true;
@@ -120,7 +117,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
"${VPN_START[@]}" >/dev/null 2>&1 & "${VPN_START[@]}" >/dev/null 2>&1 &
sleep 30s sleep 30s
rm -f ${MMFOLDER}/mm.stop* rm -f ${MMFOLDER}/mm.stop*
rm -f ${MMFOLDER}/mm.checking rm -f ${MMFOLDER}/mm.stop.checking
[ $VERBOSE = true ] && DEBUGLOGSTOP [ $VERBOSE = true ] && DEBUGLOGSTOP
exit 1 exit 1
elif [ -f ${MMFOLDER}/mm.vpn.fail2 ]; then elif [ -f ${MMFOLDER}/mm.vpn.fail2 ]; then
@@ -139,7 +136,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
"${VPN_START[@]}" >/dev/null 2>&1 & "${VPN_START[@]}" >/dev/null 2>&1 &
sleep 30s sleep 30s
rm -f ${MMFOLDER}/mm.stop* rm -f ${MMFOLDER}/mm.stop*
rm -f ${MMFOLDER}/mm.checking rm -f ${MMFOLDER}/mm.stop.checking
[ $VERBOSE = true ] && DEBUGLOGSTOP [ $VERBOSE = true ] && DEBUGLOGSTOP
exit 1 exit 1
fi fi
@@ -428,7 +425,7 @@ MMSTATUS(){
else else
echo -e "${idsCL[Red]}Not correct${idsCL[Default]}" echo -e "${idsCL[Red]}Not correct${idsCL[Default]}"
echo echo
if [ ! -f ${MMFOLDER}/mm.checking ]; then if [ ! -f ${MMFOLDER}/mm.stop.checking ]; then
echo -e "${idsCL[LightCyan]}Shutting down system... fix yo shit${idsCL[Default]}" echo -e "${idsCL[LightCyan]}Shutting down system... fix yo shit${idsCL[Default]}"
MMSTOP MMSTOP
fi fi
@@ -444,7 +441,7 @@ MMSTATUS(){
echo -e "${idsCL[Green]}Good${idsCL[Default]}" echo -e "${idsCL[Green]}Good${idsCL[Default]}"
else else
echo -e "${idsCL[Red]}Not Good${idsCL[Default]}" echo -e "${idsCL[Red]}Not Good${idsCL[Default]}"
if [ ! -f ${MMFOLDER}/mm.stop ] && [ ! -f ${MMFOLDER}/mm.checking ]; then if [ ! -f ${MMFOLDER}/mm.stop ] && [ ! -f ${MMFOLDER}/mm.stop.checking ]; then
echo echo
echo -e "${idsCL[LightCyan]}Restarting system...${idsCL[Default]}" echo -e "${idsCL[LightCyan]}Restarting system...${idsCL[Default]}"
MMSTOP MMSTOP

19
run.sh
View File

@@ -70,19 +70,26 @@ else
if [ "${1}" == "clear" ]; then if [ "${1}" == "clear" ]; then
rm -f ${MMFOLDER}/mm.* rm -f ${MMFOLDER}/mm.*
fi fi
if [ -f ${MMFOLDER}/mm.checking ] && [ "${1}" != "status" ]; then if [ -f ${MMFOLDER}/mm.stop.checking ] && [ "${1}" != "status" ]; then
fd=$(expr $(date +%s) - $(stat -L --format %Y ${MMFOLDER}/mm.checking)) fd=$(expr $(date +%s) - $(stat -L --format %Y ${MMFOLDER}/mm.stop.checking))
# if [ -f ${MMFOLDER}/mm.stop.checking ]; then
# rm -f ${MMFOLDER}/mm.stop*
# fi
if [ ${fd} -gt 900 ]; then if [ ${fd} -gt 900 ]; then
rm -f ${MMFOLDER}/mm.checking rm -f ${MMFOLDER}/mm.stop*
elif [ "${1}" = "check" ] && [ "$(ip link | grep "${VPN_INTERFACE}")" = "" ] && [ ! -f ${MMFOLDER}/mm.vpn* ]; then
rm -f ${MMFOLDER}/mm.stop*
else else
echo -e "${idsCL[LightCyan]}Try again later, 'mm' program currently in use...${idsCL[Default]}" echo -e "${idsCL[LightCyan]}Try again later, 'mm' program currently in use...${idsCL[Default]}"
fi fi
fi fi
if [ ! -f ${MMFOLDER}/mm.checking ] || [ "${1}" == "status" ]; then if [ ! -f ${MMFOLDER}/mm.stop.checking ] || [ "${1}" == "status" ]; then
touch ${MMFOLDER}/mm.checking touch ${MMFOLDER}/mm.stop.checking
${MMFOLDER}/mm-scripts.sh ${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14} ${MMFOLDER}/mm-scripts.sh ${1} ${2} ${3} ${4} ${5} ${6} ${7} ${8} ${9} ${10} ${11} ${12} ${13} ${14}
rm -f ${MMFOLDER}/mm.checking rm -f ${MMFOLDER}/mm.stop.checking
fi fi
fi fi