mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
omr-schedule service script fix no output
This commit is contained in:
parent
1457411c71
commit
ad1cbe6958
1 changed files with 26 additions and 26 deletions
|
@ -9,44 +9,44 @@
|
|||
# If a service is down, force restart it
|
||||
if [ -f /etc/init.d/shadowsocks-libev ] && [ "$(pgrep -f omr-tracker-ss)" = "" ] && [ "$(pgrep -f ss-redir)" = "" ] && [ "$(pgrep -f ss-local)" = "" ] && [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "192.18.1.3" ] && [ "$(uci -q get shadowsocks-libev.sss0.key)" != "" ]; then
|
||||
_log "Can't find Shadowsocks, restart it..."
|
||||
/etc/init.d/shadowsocks-libev restart 2>&1 >/dev/null
|
||||
/etc/init.d/shadowsocks-libev restart >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
||||
if [ -f /etc/init.d/shadowsocks-rust ] && [ "$(pgrep -f omr-tracker-ss)" = "" ] && [ "$(pgrep -f sslocal)" = "" ] && [ "$(pgrep -f sslocal)" = "" ] && [ "$(uci -q get shadowsocks-rust.sss0.disabled)" != "1" ] && [ "$(uci -q get shadowsocks-rust.sss0.server)" != "" ] && [ "$(uci -q get shadowsocks-rust.sss0.server)" != "192.18.1.3" ] && [ "$(uci -q get shadowsocks-rust.sss0.key)" != "" ]; then
|
||||
_log "Can't find Shadowsocks Rust, restart it..."
|
||||
/etc/init.d/shadowsocks-rust restart 2>&1 >/dev/null
|
||||
/etc/init.d/shadowsocks-rust restart >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
||||
if [ -f /etc/init.d/glorytun ] && [ "$(pgrep glorytun)" = "" ] && [ "$(uci -q get glorytun.vpn.enable)" = "1" ] && [ -f /etc/init.d/glorytun ] && [ "$(uci -q get glorytun.vpn.key)" != "" ]; then
|
||||
_log "Can't find Glorytun, restart it..."
|
||||
/etc/init.d/glorytun restart 2>&1 >/dev/null
|
||||
/etc/init.d/glorytun restart >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
||||
if [ -f /etc/init.d/glorytun-udp ] && [ "$(pgrep glorytun-udp)" = "" ] && [ "$(uci -q get glorytun-usp.vpn.enable)" = "1" ] && [ -f /etc/init.d/glorytun-udp ] && [ "$(uci -q get glorytun-udp.vpn.key)" != "" ]; then
|
||||
_log "Can't find Glorytun UDP, restart it..."
|
||||
/etc/init.d/glorytun-udp restart 2>&1 >/dev/null
|
||||
/etc/init.d/glorytun-udp restart >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/dnsmasq ]; then
|
||||
if [ "$(pgrep -f dnsmasq)" = "" ]; then
|
||||
_log "Can't find dnsmasq, restart it..."
|
||||
/etc/init.d/dnsmasq restart 2>&1 >/dev/null
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
sleep 5
|
||||
elif [ "$(uci -q get openmptcprouter.settings.external_check)" != "0" ] && [ -n "$(dig +timeout=4 +tries=1 openmptcprouter.com 2>&1 | grep -i 'connection refused')" ]; then
|
||||
_log "Can't resolve via dnsmasq, restart it..."
|
||||
/etc/init.d/dnsmasq restart 2>&1 >/dev/null
|
||||
/etc/init.d/dnsmasq restart >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
||||
fi
|
||||
if [ -f /etc/init.d/unbound ] && [ "$(uci -q get unbound.@unbound[0].enabled)" = "1" ]; then
|
||||
if [ "$(pgrep -f unbound)" = "" ]; then
|
||||
_log "Can't find unbound, restart it..."
|
||||
/etc/init.d/unbound restart 2>&1 >/dev/null
|
||||
/etc/init.d/unbound restart >/dev/null 2>&1
|
||||
sleep 5
|
||||
elif [ "$(uci -q get openmptcprouter.settings.external_check)" != "0" ] && [ "$(uci -q get unbound.ub_main.listen_port)" = "5353" ] && [ -n "$(dig +timeout=4 +tries=1 openmptcprouter.com -p 5353 | grep 'ANSWER: 0')" ]; then
|
||||
_log "Can't resolve via unbound, restart it..."
|
||||
/etc/init.d/unbound restart 2>&1 >/dev/null
|
||||
/etc/init.d/unbound restart >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
||||
fi
|
||||
|
@ -60,70 +60,70 @@ if [ "$(pgrep openvpn)" = "" ] && [ -f /etc/init.d/openvpn ]; then
|
|||
config_foreach openvpn_enabled openvpn
|
||||
if [ "$openvpn_enable" = "1" ]; then
|
||||
_log "Can't find OpenVPN, restart it"
|
||||
/etc/init.d/openvpn restart 2>&1 >/dev/null
|
||||
/etc/init.d/openvpn restart >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$(pgrep mlvpn)" = "" ] && [ "$(uci -q get mlvpn.general.enable)" = "1" ] && [ -f /etc/init.d/mlvpn ] && [ "$(uci -q get mlvpn.general.password)" != "" ]; then
|
||||
_log "Can't find MLVPN, restart it..."
|
||||
/etc/init.d/mlvpn restart 2>&1 >/dev/null
|
||||
/etc/init.d/mlvpn restart >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
||||
if [ "$(pgrep dsvpn)" = "" ] && [ "$(uci -q get dsvpn.vpn.enable)" = "1" ] && [ -f /etc/init.d/dsvpn ] && [ "$(uci -q get dsvpn.vpn.key)" != "" ]; then
|
||||
_log "Can't find DSVPN, restart it..."
|
||||
/etc/init.d/dsvpn restart 2>&1 >/dev/null
|
||||
/etc/init.d/dsvpn restart >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
||||
if [ "$(pgrep -f v2ray)" = "" ] && [ "$(uci -q get v2ray.main.enabled)" = "1" ] && [ -f /etc/init.d/v2ray ]; then
|
||||
_log "Can't find V2Ray, restart it..."
|
||||
/etc/init.d/v2ray restart 2>&1 >/dev/null
|
||||
/etc/init.d/v2ray restart >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
||||
if [ "$(pgrep -f xray)" = "" ] && [ "$(uci -q get xray.main.enabled)" = "1" ] && [ -f /etc/init.d/xray ]; then
|
||||
_log "Can't find XRay, restart it..."
|
||||
/etc/init.d/xray restart 2>&1 >/dev/null
|
||||
/etc/init.d/xray restart >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
||||
if [ "$(pgrep miniupnpd)" = "" ] && [ "$(uci -q get upnpd.config.enabled)" = "1" ] && [ -f /etc/init.d/miniupnpd ]; then
|
||||
_log "Can't find miniupnpd, restart it..."
|
||||
/etc/init.d/miniupnpd restart 2>&1 >/dev/null
|
||||
/etc/init.d/miniupnpd restart >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
if [ "$(pgrep rpcd)" = "" ] && [ -f /etc/init.d/rpcd ]; then
|
||||
_log "Can't find rpcd, restart it..."
|
||||
/etc/init.d/rpcd restart 2>&1 >/dev/null
|
||||
/etc/init.d/rpcd restart >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
if [ "$(pgrep uhttpd)" = "" ] && [ -f /etc/init.d/uhttpd ]; then
|
||||
_log "Can't find uhttpd, restart it..."
|
||||
/etc/init.d/uhttpd restart 2>&1 >/dev/null
|
||||
/etc/init.d/uhttpd restart >/dev/null 2>&1
|
||||
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 2>&1 >/dev/null
|
||||
/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 2>&1 >/dev/null
|
||||
/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 2>&1 >/dev/null
|
||||
# /etc/init.d/modemmanager stop >/dev/null 2>&1
|
||||
# sleep 5
|
||||
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 2>&1 >/dev/null
|
||||
/etc/init.d/omr-tracker restart >/dev/null 2>&1
|
||||
fi
|
||||
if [ "$(uci -q get xray.main.enabled)" = "1" ] && [ -f /etc/init.d/xray ] && [ "$(pgrep -f omr-tracker-xray)" = "" ] && [ "$(pgrep -f '/etc/init.d/omr-tracker')" = "" ]; then
|
||||
_log "Can't find omr-tracker-xray, restart omr-tracker..."
|
||||
/etc/init.d/omr-tracker restart 2>&1 >/dev/null
|
||||
/etc/init.d/omr-tracker restart >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
set_get_config() {
|
||||
|
@ -176,19 +176,19 @@ multipath_fix() {
|
|||
config_get multipath "$1" multipath
|
||||
[ "$multipath" != "off" ] && return
|
||||
interface="$(ifstatus $1 | jsonfilter -q -e '@.l3_device' | tr -d '\n')"
|
||||
[ -n "$interface" ] && [ -z "$(multipath $interface | grep deactivated)" ] && /etc/init.d/mptcp reload $interface 2>&1 >/dev/null
|
||||
[ -n "$interface" ] && [ -z "$(multipath $interface | grep deactivated)" ] && /etc/init.d/mptcp reload $interface >/dev/null 2>&1
|
||||
}
|
||||
|
||||
config_load network
|
||||
config_foreach multipath_fix interface
|
||||
if [ -f /etc/init.d/shadowsocks-libev ] && [ "$(uci -q get shadowsocks-libev.sss0.disabled)" != "1" ] && [ "$(uci -q get shadowsocks-libev.sss0.key)" != "" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "" ] && [ "$(uci -q get shadowsocks-libev.sss0.server)" != "192.168.1.3" ] && [ "$(pgrep -f omr-tracker-ss)" = "" ] && [ "$(pgrep -f '/etc/init.d/omr-tracker')" = "" ]; then
|
||||
_log "Can't find omr-tracker-ss for Shadowsocks libev, restart omr-tracker..."
|
||||
/etc/init.d/omr-tracker restart 2>&1 >/dev/null
|
||||
/etc/init.d/omr-tracker restart >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/shadowsocks-rust ] && [ "$(uci -q get shadowsocks-rust.sss0.disabled)" != "1" ] && [ "$(uci -q get shadowsocks-rust.sss0.key)" != "" ] && [ "$(uci -q get shadowsocks-rust.sss0.server)" != "" ] && [ "$(uci -q get shadowsocks-libev.rust.server)" != "192.168.1.3" ] && [ "$(pgrep -f omr-tracker-ss)" = "" ] && [ "$(pgrep -f '/etc/init.d/omr-tracker')" = "" ]; then
|
||||
_log "Can't find omr-tracker-ss for Shadowsocks Rust, restart omr-tracker..."
|
||||
/etc/init.d/omr-tracker restart 2>&1 >/dev/null
|
||||
/etc/init.d/omr-tracker restart >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ "$(uci -q get glorytun.vpn.enable)" = "1" ] && [ "$(uci -q get glorytun.vpn.key)" = "" ]; then
|
||||
|
@ -218,14 +218,14 @@ fi
|
|||
|
||||
if [ -f /etc/init.d/omr-bypass ] && (([ -e /usr/sbin/iptables-nft-save ] && [ "$(iptables-nft-save 2>/dev/null | grep omr-bypass)" = "" ]) || [ "$(iptables-save 2>/dev/null | grep omr-bypass)" = "" ]) && [ "$(pgrep -f omr-bypass)" = "" ]; then
|
||||
_log "Can't find omr-bypass rules, restart omr-bypass..."
|
||||
/etc/init.d/omr-bypass start 2>&1 >/dev/null
|
||||
/etc/init.d/omr-bypass start >/dev/null 2>&1
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
if [ -f /etc/backup/installed_packages.txt ] && [ -n "$(grep overlay /etc/backup/installed_packages.txt)" ] && ([ "$(uci -q get openmptcprouter.settings.sysupgrade_lc)" = "" ] || [ $(($(date +"%s") + $((30 + RANDOM % 31)) - $(uci -q get openmptcprouter.settings.sysupgrade_lc))) -gt 3600 ]) && [ $(($(date +"%s") - $(stat -c "%Y" /etc/backup/installed_packages.txt))) -gt 86400 ]; then
|
||||
_log "Reinstall packages..."
|
||||
uci -q set openmptcprouter.settings.sysupgrade_lc=$(date +"%s")
|
||||
/etc/init.d/sysupgrade restart 2>&1 >/dev/null
|
||||
/etc/init.d/sysupgrade restart >/dev/null 2>&1
|
||||
sleep 10
|
||||
fi
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue