提交 342487e4 编写于 作者: V vCaesar

Add 12.3.md syntax highlighting

上级 0b45cdad
......@@ -7,6 +7,8 @@
- MarGo的一个实现思路,使用Commond来执行自身的应用,如果真想实现,那么推荐这种方案
```Go
d := flag.Bool("d", false, "Whether or not to launch in the background(like a daemon)")
if *d {
cmd := exec.Command(os.Args[0],
......@@ -32,8 +34,10 @@
cmd.Process.Kill()
}
}
```
- 另一种是利用syscall的方案,但是这个方案并不完善:
```Go
package main
......@@ -103,7 +107,8 @@
return 0
}
```
上面提出了两种实现Go的daemon方案,但是我还是不推荐大家这样去实现,因为官方还没有正式的宣布支持daemon,当然第一种方案目前来看是比较可行的,而且目前开源库skynet也在采用这个方案做daemon。
## Supervisord
......@@ -121,6 +126,8 @@ Supervisord可以通过`sudo easy_install supervisor`安装,当然也可以通
### Supervisord配置
Supervisord默认的配置文件路径为/etc/supervisord.conf,通过文本编辑器修改这个文件,下面是一个示例的配置文件:
```conf
;/etc/supervisord.conf
[unix_http_server]
file = /var/run/supervisord.sock
......@@ -161,6 +168,7 @@ Supervisord默认的配置文件路径为/etc/supervisord.conf,通过文本编
redirect_stderr = true
stdout_logfile = /var/log/supervisord/blogdemon.log
```
### Supervisord管理
Supervisord安装完成后有两个可用的命令行supervisor和supervisorctl,命令使用解释如下:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册