因为使用goagent进行翻墙,每次要手工启动感觉很麻烦,所以就找了下自动执行脚本的方法,配置方法见下面:
1、自动执行脚本需要直接运行可执行脚本,所以先创建一个可执行的shell脚本:
$ ls -l start_goagent.sh
-rwxrwxrwx 1 trams staff 63 Nov 29 07:15 start_goagent.sh
start_goagent.sh
#/bin/ksh
python /Applications/goagent-goagent/local/proxy.py
2、创建plist
$ ls -la com.hellwen.start_goagent.plist
-rw-r--r--@ 1 trams staff 447 Dec 7 20:09 com.hellwen.start_goagent.plist
com.hellwen.start_goagent.plist存放位置:/Users/XXX/Library/LaunchAgents
其中XXX为你自己的用户名称
com.hellwen.start_goagent.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.hellwen.start_goagent</string>
<key>ProgramArguments</key>
<array>
<string>/Users/trams/Documents/start_goagent.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/dev/null</string>
</dict>
</plist>
到这里就可以了,在用户登录的时候会自动执行start_goagent.sh
参考:http://blog.csdn.net/abby_sheen/article/details/7817198
没有评论:
发表评论