mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-12 18:41:51 +00:00
Add and remove logs on omr-tracker
This commit is contained in:
parent
095a7b0b51
commit
1bcfffa392
2 changed files with 33 additions and 29 deletions
|
@ -664,7 +664,7 @@ disable_pihole() {
|
|||
commit dhcp
|
||||
EOF
|
||||
fi
|
||||
/etc/init.d/dnsmasq restart
|
||||
/etc/init.d/dnsmasq restart 2>&1 >/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -746,7 +746,7 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || [ "$interface_up" != "true" ]; then
|
|||
commit openvpn
|
||||
EOF
|
||||
fi
|
||||
/etc/init.d/openvpn restart $VPN_BASE_INTF
|
||||
/etc/init.d/openvpn restart $VPN_BASE_INTF 2>&1 >/dev/null
|
||||
fi
|
||||
config_load openmptcprouter
|
||||
config_foreach del_server_route server
|
||||
|
@ -824,25 +824,25 @@ if [ "$OMR_TRACKER_STATUS" = "ERROR" ] || [ "$interface_up" != "true" ]; then
|
|||
_log "Tunnel down use ShadowSocks for UDP"
|
||||
uci -q set shadowsocks-libev.ss_rules.redir_udp='hi1'
|
||||
if /etc/init.d/shadowsocks-libev rules_exist ; then
|
||||
/etc/init.d/shadowsocks-libev rules_down
|
||||
/etc/init.d/shadowsocks-libev rules_up
|
||||
/etc/init.d/shadowsocks-libev rules_down 2>&1 >/dev/null
|
||||
/etc/init.d/shadowsocks-libev rules_up 2>&1 >/dev/null
|
||||
fi
|
||||
fi
|
||||
if [ "$(uci -q get dsvpn.vpn.enable)" = "1" ]; then
|
||||
_log "DSVPN down, restart it"
|
||||
/etc/init.d/dsvpn restart
|
||||
/etc/init.d/dsvpn restart 2>&1 >/dev/null
|
||||
fi
|
||||
if [ "$(uci -q get mlvpn.general.enable)" = "1" ]; then
|
||||
_log "MLVPN down, restart it"
|
||||
/etc/init.d/mlvpn restart
|
||||
/etc/init.d/mlvpn restart 2>&1 >/dev/null
|
||||
fi
|
||||
if [ "$(uci -q get glorytun.vpn.enable)" = "1" ]; then
|
||||
_log "Glorytun VPN down, restart it"
|
||||
/etc/init.d/glorytun restart
|
||||
/etc/init.d/glorytun restart 2>&1 >/dev/null
|
||||
fi
|
||||
if [ "$(uci -q get glorytun-udp.vpn.enable)" = "1" ]; then
|
||||
_log "Glorytun UDP VPN down, restart it"
|
||||
/etc/init.d/glorytun-udp restart
|
||||
/etc/init.d/glorytun-udp restart 2>&1 >/dev/null
|
||||
fi
|
||||
config_load openmptcprouter
|
||||
config_foreach disable_pihole server
|
||||
|
@ -935,7 +935,7 @@ if [ "$OMR_TRACKER_INTERFACE" = "glorytun" ] || [ "$OMR_TRACKER_INTERFACE" = "om
|
|||
config_load openmptcprouter
|
||||
config_foreach enable_pihole server
|
||||
#config_foreach delete_server_default_route server
|
||||
[ "$nbserver" = "$piholeenabled" ] && /etc/init.d/openmptcprouter-vps set_pihole
|
||||
[ "$nbserver" = "$piholeenabled" ] && /etc/init.d/openmptcprouter-vps set_pihole 2>&1 >/dev/null
|
||||
#ubus call network reload
|
||||
exit 0
|
||||
fi
|
||||
|
@ -1219,7 +1219,7 @@ if [ -n "$OMR_TRACKER_INTERFACE" ] && ([ "$(uci -q get openmptcprouter.$OMR_TRAC
|
|||
_log "New public ip detected for $OMR_TRACKER_INTERFACE ($OMR_TRACKER_DEVICE): $ipaddr"
|
||||
/etc/init.d/mptcp enabled && {
|
||||
_log "Reload MPTCP for $OMR_TRACKER_DEVICE"
|
||||
/etc/init.d/mptcp reload "$OMR_TRACKER_DEVICE" >/dev/null
|
||||
/etc/init.d/mptcp reload "$OMR_TRACKER_DEVICE" 2>&1 >/dev/null
|
||||
}
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.publicip="$ipaddr"
|
||||
}
|
||||
|
@ -1323,7 +1323,7 @@ if [ -n "$OMR_TRACKER_INTERFACE" ] && ([ "$(uci -q get openmptcprouter.$OMR_TRAC
|
|||
_log "New public ip detected for $OMR_TRACKER_INTERFACE ($OMR_TRACKER_DEVICE): $ip6addr"
|
||||
/etc/init.d/mptcp enabled && {
|
||||
_log "Reload MPTCP for $OMR_TRACKER_DEVICE"
|
||||
/etc/init.d/mptcp reload "$OMR_TRACKER_DEVICE" >/dev/null
|
||||
/etc/init.d/mptcp reload "$OMR_TRACKER_DEVICE" 2>&1 >/dev/null
|
||||
}
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.publicip="$ip6addr"
|
||||
}
|
||||
|
@ -1421,7 +1421,7 @@ fi
|
|||
masterintf="$(uci -q show openmptcprouter | grep -m 1 multipath=\'master\' | cut -d'.' -f2)"
|
||||
[ -z "$masterintf" ] && masterintf="$(uci -q show network | grep -m 1 multipath=\'master\' | cut -d'.' -f2)"
|
||||
masterlatency="$(uci -q get openmptcprouter.$masterintf.latency | tr -d '\n')"
|
||||
if [ -z "$masterlatency" ] || ([ -n "$masterintf" ] &&[ "$(uci -q get openmptcprouter.$masterintf.state)" = "down" ]); then
|
||||
if [ -z "$masterlatency" ] || ([ -n "$masterintf" ] && [ "$(uci -q get openmptcprouter.$masterintf.state)" = "down" ]); then
|
||||
masterlatency=1000
|
||||
fi
|
||||
if [ -n "$masterintf" ] && ([ "$masterlatency" != "" ] || [ "$(uci -q get openmptcprouter.$masterintf.state)" = "down" ]); then
|
||||
|
@ -1449,22 +1449,22 @@ fi
|
|||
# If a service is down, force restart it
|
||||
if [ "$(pgrep ss-redir)" = "" ] && [ "$(pgrep 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
|
||||
/etc/init.d/shadowsocks-libev restart 2>&1 >/dev/null
|
||||
sleep 5
|
||||
fi
|
||||
if [ "$(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
|
||||
/etc/init.d/glorytun restart 2>&1 >/dev/null
|
||||
sleep 5
|
||||
fi
|
||||
if [ "$(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
|
||||
/etc/init.d/glorytun-udp restart 2>&1 >/dev/null
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
if [ "$(pgrep unbound)" = "" ] && [ -f /etc/init.d/unbound ] && [ "$(uci -q get unbound.@unbound[0].enabled)" = "1" ]; then
|
||||
/etc/init.d/unbound restart
|
||||
/etc/init.d/unbound restart 2>&1 >/dev/null
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
|
@ -1477,53 +1477,53 @@ 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
|
||||
/etc/init.d/openvpn restart 2>&1 >/dev/null
|
||||
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
|
||||
/etc/init.d/mlvpn restart 2>&1 >/dev/null
|
||||
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
|
||||
/etc/init.d/dsvpn restart 2>&1 >/dev/null
|
||||
sleep 5
|
||||
fi
|
||||
if [ "$(pgrep 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
|
||||
/etc/init.d/v2ray restart 2>&1 >/dev/null
|
||||
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
|
||||
/etc/init.d/miniupnpd restart 2>&1 >/dev/null
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
if [ "$(pgrep rpcd)" = "" ] && [ -f /etc/init.d/rpcd ]; then
|
||||
_log "Can't find rpcd, restart it..."
|
||||
/etc/init.d/rpcd restart
|
||||
/etc/init.d/rpcd restart 2>&1 >/dev/null
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
if [ "$(pgrep uhttpd)" = "" ] && [ -f /etc/init.d/uhttpd ]; then
|
||||
_log "Can't find uhttpd, restart it..."
|
||||
/etc/init.d/uhttpd restart
|
||||
/etc/init.d/uhttpd restart 2>&1 >/dev/null
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
#if [ "$(pgrep ModemManager)" = "" ] && [ -f /etc/init.d/modemmanager ] && [ -n "$(uci -q show network | grep modemmanager)" ] && [ "$(uci -q get openmptcprouter.settings.modemmanager)" != "0" ]; then
|
||||
# _log "Can't find ModemManager, restart it..."
|
||||
# /etc/init.d/modemmanager restart
|
||||
# /etc/init.d/modemmanager restart 2>&1 >/dev/null
|
||||
# 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
|
||||
/etc/init.d/omr-tracker restart 2>&1 >/dev/null
|
||||
fi
|
||||
|
||||
set_get_config() {
|
||||
|
@ -1539,7 +1539,7 @@ fi
|
|||
|
||||
if [ "$(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.18.1.3" ] && [ "$(pgrep -f omr-tracker-ss)" = "" ] && [ "$(pgrep -f '/etc/init.d/omr-tracker')" = "" ]; then
|
||||
_log "Can't find omr-tracker-ss, restart omr-tracker..."
|
||||
/etc/init.d/omr-tracker restart
|
||||
/etc/init.d/omr-tracker restart 2>&1 >/dev/null
|
||||
fi
|
||||
|
||||
if [ "$(uci -q get glorytun.vpn.enable)" = "1" ] && [ "$(uci -q get glorytun.vpn.key)" = "" ]; then
|
||||
|
@ -1563,12 +1563,12 @@ fi
|
|||
|
||||
if [ "$(iptables-save | grep omr-bypass)" = "" ] && [ "$(pgrep omr-bypass)" = "" ]; then
|
||||
_log "Can't find omr-bypass rules, restart omr-bypass..."
|
||||
/etc/init.d/omr-bypass
|
||||
/etc/init.d/omr-bypass 2>&1 >/dev/null
|
||||
fi
|
||||
|
||||
if [ -f /etc/backup/installed_packages.txt ]; then
|
||||
_log "Reinstall packages..."
|
||||
/etc/init.d/sysupgrade restart
|
||||
/etc/init.d/sysupgrade restart 2>&1 >/dev/null
|
||||
fi
|
||||
|
||||
if [ "$(pgrep openmptcprouter-vps)" = "" ] && ([ "$(uci -q show openmptcprouter | grep get_config=\'1\')" != "" ] || [ "$(uci -q show openmptcprouter | grep admin_error=\'1\')" != "" ]); then
|
||||
|
|
|
@ -85,7 +85,11 @@ _post_tracking() {
|
|||
_log() {
|
||||
logger -t "post-tracking-${tracker_bin##*/}" "$*"
|
||||
}
|
||||
. "$tracker_bin"
|
||||
tmp=$(mktemp)
|
||||
. "$tracker_bin" 2>&1 > "$tmp"
|
||||
trackresult=$(< "$tmp")
|
||||
[ -n "$trackresult" ] && _log $trackresult
|
||||
rm -f "$tmp"
|
||||
)
|
||||
done
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue