linux

代替supervisor - gosuv

2018-10-29  本文已影响262人  冰_Angus

项目的部署

一. 安装gosuv Git地址

二. 将gosuv安装为linux的系统服务

1.编写systemd的单元配置文件 (启动命令ExecStart和启动路径WorkingDirectory酌情修改)
[Unit]
Description=gosuv
After=syslog.target
After=network.target

[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
Type=simple  # 如果要启动的命令是一个daemon进程, 这里的值设置为forking
User=root
Group=root
# 可以将gosuv链接到bin目录或者直接移动到bin目录
WorkingDirectory=/usr/local/bin
# -f 参数指定gosuv前台启动,默认后台启动(如果没有-f参数, 则Type需要改为forking)
ExecStart=/usr/local/bin/gosuv start-server -f
Restart=always

# Some distributions may not support these hardening directives. If you cannot start the service due
# to an unknown option, comment out the ones not supported by your version of systemd.
ProtectSystem=full
PrivateDevices=yes
PrivateTmp=yes
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

2. 将此文件放到 /lib/systemd/system文件夹下,此时就能够让服务开机启动和自动重启了
上一篇下一篇

猜你喜欢

热点阅读