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" ""
echo "$(date) - Starting Media Management system - (fresh start)" >> $logfile
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
GOFORSTART=true;
@@ -120,7 +117,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
"${VPN_START[@]}" >/dev/null 2>&1 &
sleep 30s
rm -f ${MMFOLDER}/mm.stop*
rm -f ${MMFOLDER}/mm.checking
rm -f ${MMFOLDER}/mm.stop.checking
[ $VERBOSE = true ] && DEBUGLOGSTOP
exit 1
elif [ -f ${MMFOLDER}/mm.vpn.fail2 ]; then
@@ -139,7 +136,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
"${VPN_START[@]}" >/dev/null 2>&1 &
sleep 30s
rm -f ${MMFOLDER}/mm.stop*
rm -f ${MMFOLDER}/mm.checking
rm -f ${MMFOLDER}/mm.stop.checking
[ $VERBOSE = true ] && DEBUGLOGSTOP
exit 1
fi
@@ -428,7 +425,7 @@ MMSTATUS(){
else
echo -e "${idsCL[Red]}Not correct${idsCL[Default]}"
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]}"
MMSTOP
fi
@@ -444,7 +441,7 @@ MMSTATUS(){
echo -e "${idsCL[Green]}Good${idsCL[Default]}"
else
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 -e "${idsCL[LightCyan]}Restarting system...${idsCL[Default]}"
MMSTOP

19
run.sh
View File

@@ -70,19 +70,26 @@ else
if [ "${1}" == "clear" ]; then
rm -f ${MMFOLDER}/mm.*
fi
if [ -f ${MMFOLDER}/mm.checking ] && [ "${1}" != "status" ]; then
fd=$(expr $(date +%s) - $(stat -L --format %Y ${MMFOLDER}/mm.checking))
if [ -f ${MMFOLDER}/mm.stop.checking ] && [ "${1}" != "status" ]; then
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
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
echo -e "${idsCL[LightCyan]}Try again later, 'mm' program currently in use...${idsCL[Default]}"
fi
fi
if [ ! -f ${MMFOLDER}/mm.checking ] || [ "${1}" == "status" ]; then
touch ${MMFOLDER}/mm.checking
if [ ! -f ${MMFOLDER}/mm.stop.checking ] || [ "${1}" == "status" ]; then
touch ${MMFOLDER}/mm.stop.checking
${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