Compile the goAgent service in Ubuntu #! /Bin/sh # goagentservicebyliuzhijunstart () {echo "start &
Compile the goAgent service in Ubuntu
- #! /Bin/sh
- # Goagent service by liuzhijun
- Start (){
- Echo"Start goagent"
- Python/usr/local/share/goagent/local/proxy. py
- Exit0
- }
- 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"
- Exit0;
- Esac
Notes:
0. What does goagent do you know?
1. Do not enter exit 0 in the stop method; otherwise, the stop method will exit after it is executed during restart, and there is no chance to execute start
2. After writing the script, modify its attributes to an executable file: chmod a + x goagent.
3. This script ends the goagent process by killing all Python processes. Therefore, this script is not applicable if other python programs are running in the system.
4, if you need to boot, you can execute the command: sudo update-rc.d goagent defaults 99
Cancel boot: sudo update-rc.d-f goagent remove