Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wen-long/41e9369361fe78e98c01 to your computer and use it in GitHub Desktop.
Save wen-long/41e9369361fe78e98c01 to your computer and use it in GitHub Desktop.

/Library/LaunchDaemons 中创建 ip-up.plist 文件,内容如下

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>Label</key>
   <string>com.wenlong.setchnroute.plist</string>
   <key>ProgramArguments</key>
   <array>
   	<string>/Users/name/ip-up</string>
   </array>
   <key>KeepAlive</key>
   <false/>
   <key>RunAtLoad</key>
   <true/>
</dict>
</plist>

然后

sudo chown root:wheel /Library/LaunchDaemons/ip-up.plist
sudo chmod 644 /Library/LaunchDaemons/ip-up.plist

/Users/name/ip-up 中随便写写,最后 chmod +x 就行

PS. ip-up 其实是那个 chnroute 项目生成的路由表命令,似乎要等到网络加载上了才行,所以总是只有最后的几千条有效,我在前面加了个 sleep 9 似乎就能正常工作了(最起码看起来是正常的),如果你知道应该怎么弄,请告诉我,谢谢了!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment