GolangNote

Golang笔记

用Supervisor 守护Golang 应用进程的配置示例

Permalink

Supervisor 可以监控服务器的进程,并在出现问题是自动重启。用Supervisor 来守护Golang 应用进程是不错的选择。

Supervisor 守护Golang 应用

下面是一份用Supervisor 守护Golang 应用进程的配置:

INI: Supervisor 配置
1
2
3
4
5
6
7
8
9
10
11
12
[program:yourapp]
command=/home/yourappuser/bin/yourapp # the location of your app
autostart=true
autorestart=true
startretries=10
user=yourappuser # the user your app should run as (i.e. *not* root!)
directory=/srv/www/yourapp.com/ # where your application runs from
environment=APP_SETTINGS="/srv/www/yourapp.com/prod.toml" # environmental variables
redirect_stderr=true
stdout_logfile=/var/log/supervisor/yourapp.log # the name of the log file.
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=10

本文网址: https://golangnote.com/topic/20.html 转摘请注明来源

Related articles

golang snappy 示例

snappy 是 google 开源的一种高效的压缩算法,这里是 golang 实现的 snappy 压缩示例...

Write a Comment to "用Supervisor 守护Golang 应用进程的配置示例"

Submit Comment Login
Based on Golang + fastHTTP + sdb | go1.17.1 Processed in 0ms