【Linux】Ubuntu下安装并使用Supervisor守护gogs进程

举报
小雨青年 发表于 2022/03/29 00:08:29 2022/03/29
【摘要】 安装 root@VM-0-14-ubuntu:~/gogs# apt-get install supervisor Reading package lists... Done Building depe...

安装

root@VM-0-14-ubuntu:~/gogs# apt-get install supervisor
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  python-meld3
Suggested packages:
  supervisor-doc
The following NEW packages will be installed:
  python-meld3 supervisor
0 upgraded, 2 newly installed, 0 to remove and 129 not upgraded.
Need to get 284 kB of archives.
After this operation, 1,552 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.tencentyun.com/ubuntu xenial/universe amd64 python-meld3 all 1.0.2-2 [30.9 kB]
Get:2 http://mirrors.tencentyun.com/ubuntu xenial-security/universe amd64 supervisor all 3.2.0-2ubuntu0.2 [253 kB]
Fetched 284 kB in 0s (747 kB/s) 
Selecting previously unselected package python-meld3.
(Reading database ... 74244 files and directories currently installed.)
Preparing to unpack .../python-meld3_1.0.2-2_all.deb ...
Unpacking python-meld3 (1.0.2-2) ...
Selecting previously unselected package supervisor.
Preparing to unpack .../supervisor_3.2.0-2ubuntu0.2_all.deb ...
Unpacking supervisor (3.2.0-2ubuntu0.2) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu21.1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up python-meld3 (1.0.2-2) ...
Setting up supervisor (3.2.0-2ubuntu0.2) ...
Processing triggers for systemd (229-4ubuntu21.1) ...
Processing triggers for ureadahead (0.100.0-19) ...
  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

启动服务


root@VM-0-14-ubuntu:~/gogs# service supervisor restart
  
 
  • 1
  • 2

加入gogs作为守护进程

gogs存在的目录 /root/gogs

修改之后的配置文件

[program:gogs]
command=/root/gogs/gogs web
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/var/log/gogs/stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stderr_logfile=/var/log/gogs/stderr.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_capture_maxbytes=1MB
user = root
environment = HOME="/root", USER="root"
  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

内容写入文件 /etc/supervisor/conf.d/gogs.conf

载入配置

root@VM-0-14-ubuntu:/etc/supervisor/conf.d# supervisorctl reread
ERROR: CANT_REREAD: The directory named as part of the path /var/log/gogs/stdout.log does not exist. in section 'program:gogs' (file: '/etc/supervisor/conf.d/gogs.conf')
root@VM-0-14-ubuntu:/etc/supervisor/conf.d# mkdir /var/log/gogs
root@VM-0-14-ubuntu:/etc/supervisor/conf.d# supervisorctl reread
gogs: available

  
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

查看状态

root@VM-0-14-ubuntu:/etc/supervisor/conf.d# supervisorctl
gogs                             RUNNING   pid 13882, uptime 0:01:07
  
 
  • 1
  • 2

文章来源: coderfix.blog.csdn.net,作者:小雨青年,版权归原作者所有,如需转载,请联系作者。

原文链接:coderfix.blog.csdn.net/article/details/80975431

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。