Google one 扶墙安卓 自动重连脚本。

有时候遇到g1v偶尔断线后自动重连不太好使,给需要的人。可以用termux:boot 设置开机自启,楼主现在扔软路由上运行的 #!/bin/sh G1V_ACTIVITY=”com.google.android.apps.subscriptions.red/com.google.android.apps.subscriptions.red.main.MainActivity” TERMUX_ACTIVITY=”com.termux/com.termux.app.TermuxActivity” SERVICE=”com.google.android.apps.subscriptions.red/com.google.android.libraries.privacy.ppn.Ppn扶墙Service” STOP_扶墙_COMMAND=”am broadcast -a stop -n com.google.android.apps.subscriptions.red/com.google.android.apps.subscriptions.red.ppn.DisablePpnReceiver_Receiver” function restart_service() {     echo “$(date) – 操作: 正在关闭扶墙服务…”     $STOP_扶墙_COMMAND     echo “$(date) – 结果: 扶墙服务已关闭”     sleep 1     echo “$(date) – 操作: 正在重启服务…”     OUTPUT=$(am startservice -n “$SERVICE” 2>&1)     # 检查google one应用是否已打开”     if [[ $OUTPUT == *”Error”* ]]; then     #打开Google one     am start -n $G1V_ACTIVITY     am startservice -n “$SERVICE”     fi     echo “$(date) – 结果: 服务已重启” } tun0_missing_counter=0 while true; do     if ! dumpsys activity | grep “$SERVICE” > /dev/null; then         echo “$(date) – 服务状态: 关闭”         restart_service         sleep 10         continue     fi     if ip a | grep -q tun0; then         echo “$(date) – 网络状态: tun0接口存在”         sleep 5     else         echo “$(date) – 网络状态: tun0接口不存在”         tun0_missing_counter=$((tun0_missing_counter + 1))     fi     if [ $tun0_missing_counter -ge 3 ]; then         echo “$(date) – 警告: tun0已经超过30秒不存在”         restart_service         tun0_missing_counter=0     fi     sleep 5 done复制代码

请登录后发表评论

    • 头像做ー個明媚の钕子0
    • 头像难以启齿的高傲0
    • 头像当美景都重叠0
    • 头像靠天靠地不如靠自我0