apt update
apt install supervisor
vim /etc/supervisor/supervisord.conf
添加如下配置:
command 配置成可执行文件的路径,directory为文件所在目录
[program:tempupService]
command= /data/goService
directory=/data
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/var/log/stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=128MB
stderr_logfile=/var/log/stderr.log
stderr_logfile_maxbytes=128MB
stderr_logfile_backups=10
stderr_capture_maxbytes=12MB
然后reload、查看状态
supervisorctl reload
supervisorctl status
标签:supervisor,log,stdout,maxbytes,golang,stderr,ubuntu,logfile
From: https://www.cnblogs.com/jing1024/p/17281605.html