1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Check if ModemManager is not disable before using or launching it

This commit is contained in:
Ycarus (Yannick Chabanois) 2024-09-30 08:14:43 +02:00
parent af59ab5ad5
commit c52f6a6d23
2 changed files with 15 additions and 14 deletions

View file

@ -104,20 +104,21 @@ if [ "$(pgrep uhttpd)" = "" ] && [ -f /etc/init.d/uhttpd ]; then
sleep 5
fi
if [ -z "$(pgrep ModemManager)" ] && [ -f /etc/init.d/modemmanager ] && [ -n "$(uci -q show network | grep modemmanager)" ]; then
_log "Can't find ModemManager, restart it..."
/etc/init.d/modemmanager restart >/dev/null 2>&1
sleep 5
elif [ -n "$(pgrep ModemManager)" ] && [ -f /etc/init.d/modemmanager ] && [ -n "$(uci -q show network | grep modemmanager)" ] && [ -z "$(timeout 2 mmcli -L)" ]; then
_log "ModemManager doesn't answer, restart it..."
/etc/init.d/modemmanager restart >/dev/null 2>&1
sleep 5
#elif [ -n "$(pgrep ModemManager)" ] && [ -f /etc/init.d/modemmanager ] && [ -z "$(uci -q show network | grep modemmanager)" ]; then
# _log "ModemManager not used, stop it..."
# /etc/init.d/modemmanager stop >/dev/null 2>&1
# sleep 5
if [ "$(uci -q get openmptcprouter.settings.disable_modemmanager)" != "1" ]; then
if [ -z "$(pgrep ModemManager)" ] && [ -f /etc/init.d/modemmanager ] && [ -n "$(uci -q show network | grep modemmanager)" ]; then
_log "Can't find ModemManager, restart it..."
/etc/init.d/modemmanager restart >/dev/null 2>&1
sleep 5
elif [ -n "$(pgrep ModemManager)" ] && [ -f /etc/init.d/modemmanager ] && [ -n "$(uci -q show network | grep modemmanager)" ] && [ -z "$(timeout 2 mmcli -L)" ]; then
_log "ModemManager doesn't answer, restart it..."
/etc/init.d/modemmanager restart >/dev/null 2>&1
sleep 5
#elif [ -n "$(pgrep ModemManager)" ] && [ -f /etc/init.d/modemmanager ] && [ -z "$(uci -q show network | grep modemmanager)" ]; then
# _log "ModemManager not used, stop it..."
# /etc/init.d/modemmanager stop >/dev/null 2>&1
# sleep 5
fi
fi
if [ "$(uci -q get v2ray.main.enabled)" = "1" ] && [ -f /etc/init.d/v2ray ] && [ "$(pgrep -f omr-tracker-v2ray)" = "" ] && [ "$(pgrep -f '/etc/init.d/omr-tracker')" = "" ]; then
_log "Can't find omr-tracker-v2ray, restart omr-tracker..."
/etc/init.d/omr-tracker restart >/dev/null 2>&1