Ubuntu下编写 goAgent 服务
- #!/bin/sh
-
- # goagent service by liuzhijun
-
- start(){
- echo "start goagent"
-
- python /usr/local/share/goagent/local/proxy.py
-
- exit 0
-
- }
-
- stop(){
- echo "stop goagent"
- ps -le |grep python |awk "{print $4}"| xargs kill -9
- }
-
-
- restart(){
- echo "restart goagent"
- stop
- start
- }
-
- case "$1" in
-
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart)
- restart
- ;;
- *)
-
- echo "usage:$0 start|stop|restart"
-
- exit 0;
-
- esac
几点说明:
0、goagent 是什么你懂的
1、在stop方法中不要写exit 0,否则在重启时,执行完stop方法后就退出了,没有机会执行start
2、编写完脚本后修改其属性为可执行 文件: chmod a+x goagent
3、此脚本是以杀掉所有Python进程来结束goagent进程,所以 如果系统中还运行有其他python的程序,此脚本不适用。
4、如果需要开机启动,可以执行命令:sudo update-rc.d goagent defaults 99
取消开机启动: sudo update-rc.d -f goagent removeMac/Linux 多线程下载解决方案在SecureCRT下使用rz和sz命令上传和下载文件相关资讯 GoAgent
- 在Linux系统中部署Goagent (06/02/2012 10:33:30)
| - Ubuntu 10.10 配置GoAgent (05/07/2012 10:32:11)
|
本文评论 查看全部评论 (0)