Created
May 6, 2013 06:01
-
-
Save ziggear/5523572 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#说明 | |
#1. [ -z "$1" ] 判断字符串是否为空 | |
#2. [ $1 == "off" ] && foo 简化的if写法 | |
#3. nohup foo & 让程序在后台运行 | |
#4. xargs 让管道的输出作为args (正常情况管道的输出是作为标准输入) | |
function goagent() { | |
if [ -z "$1" ] ; then | |
echo "Args too few" | |
echo "e.g. goagent on" | |
else | |
[ $1 == "on" ] && nohup python /path/to/goagent/local/proxy.py & | |
[ $1 == "off" ] && ps | grep python | awk 'NR==1{print $4}' | xargs killall $1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment