欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

bud_repair_zhong bud 问题排查 bug 排查 这个策略之前 应该还会执行更新 hosts 的脚本 自己亲自做的有大用

更新hosts脚本见  /node-admin/21166


#!/bin/bash
#
# 加个时间判断
my_time=`date +%s`
let time_diff=$(expr $time_from_jsfaq - $my_time) #相差秒数
time_diff=$(awk -v td="$time_diff" 'BEGIN {print (td < 0) ? -td : td}') #取相差秒数的绝对值
if [ $time_diff -gt 30 ];then  #假如时间差大于30秒,就从faq上更新时间
 formatted_date_time=$(date -r $time_from_jsfaq "+%m%d%H%M%Y.%S")
 sudo date "$formatted_date_time"
 (/usr/bin/osascript -e  'display dialog "时间不准,已更新;hosts文件已更新,确保您是nst连网权限,或者在沙箱内执行,请到 https://192.192.191.192:443 上网认证试试!" buttons {"OK"} default button "OK"')
 open -a "Safari" https://192.192.191.192:443
else
(/usr/bin/osascript -e  'display dialog "hosts文件已更新,确保您是nst连网权限,或者在沙箱内执行,请到 https://192.192.191.192:443 上网认证试试!" buttons {"OK"} default button "OK"')
fi
# 定义 appleconnect 的路径
APPLE_CONNECT_PATH="/usr/local/bin/appleconnect"
if [ ! -f "$APPLE_CONNECT_PATH" ]; then
    (/usr/bin/osascript -e  'display dialog "appleconnect 未安装,请安装" buttons {"OK"} default button "OK"')
    else
       "$APPLE_CONNECT_PATH" --version
       if [ $? -ne 0 ];then
          (/usr/bin/osascript -e  'display dialog "appleconnect 无法正常运行,可能已损坏" buttons {"OK"} default button "OK"')
          else
            full_ver=$(sw_vers -productVersion)
            ver=`sw_vers -productVersion | cut -d'.' -f1`
            appleconnect_ver=$(/usr/local/bin/appleconnect --version)
            appleconnect_big_ver=$(/usr/local/bin/appleconnect --version | cut -d '.' -f 1)

            if  [ $ver -ge 13 ] && [ $appleconnect_big_ver -lt 6 ]; then
                (/usr/bin/osascript -e  "display dialog \"macos 版本为 ${full_ver} , appleconnect 版本为 ${appleconnect_ver} ,版本不对! \" buttons {\"OK\"} default button \"OK\" ")
            elif [ $ver -ge 11 ] &&  [ $ver -le 12 ] && [ $appleconnect_big_ver -ne 5  ]; then
                (/usr/bin/osascript -e  "display dialog \"macos 版本为 ${full_ver} , appleconnect 版本为 ${appleconnect_ver} ,版本不对! \" buttons {\"OK\"} default button \"OK\" ")
            elif [ $appleconnect_big_ver -lt 5  ]; then
                (/usr/bin/osascript -e  "display dialog \"macos 版本为 ${full_ver} , appleconnect 版本为 ${appleconnect_ver} ,版本可能不对! \" buttons {\"OK\"} default button \"OK\" ")
            else
                (/usr/bin/osascript -e  "display dialog \"macos 版本为 ${full_ver} , appleconnect 版本为 ${appleconnect_ver} ,请检查版本对不对! \" buttons {\"OK\"} default button \"OK\" ")
            fi  
          fi    
fi

chrome_path="/Applications/Google Chrome.app/Contents/Info.plist"
if [ -f "$chrome_path" ]; then
    #chrome_ver=$(defaults read /Applications/Google\ Chrome.app/Contents/Info.plist CFBundleShortVersionString | cut -d '.' -f 1)
    chrome_ver=$(plutil -extract CFBundleShortVersionString raw "$chrome_path" | cut -d '.' -f 1)
else
    echo chrome_ver="不存在,可能未安装。"
fi
(/usr/bin/osascript -e  "display dialog \"可能的原因:1)请找JS-ES绑定BUD与电脑的关系! 2)chrome 版本 ${chrome_ver},是否偏低! 2)chrome浏览器没有安装appleconnect插件!\" buttons {\"OK\"} default button \"OK\" ")


普通分类: