宝塔面板

如果是使用宝塔面板搭建的cloudreve的话进程守护就非常简单

  • 打开应用商店安装Supervisor管理器
  • 打开Supervisor管理器
  • 添加守护进程

Supervisor管理器

  • 名称随便填
  • 运行目录就是程序安装的目录(例如/www/wwwroot/test)
  • 启动命令(例如/www/wwwroot/test/cloudreve)

Syetemctl进程守护

创建cloudreve.service文件并放在/usr/lib/systemd/system/下(CentOS操作系统) 内容如下

[Unit]
Description=Cloudreve
Documentation=https://docs.cloudreve.org
After=network.target
After=mysqld.service
Wants=network.target
[Service]
WorkingDirectory=/PATH_TO_CLOUDREVE
ExecStart=/PATH_TO_CLOUDREVE/cloudreve
Restart=on-abnormal
RestartSec=5s
KillMode=mixed
StandardOutput=null
StandardError=syslog
[Install]
WantedBy=multi-user.target
  • WorkingDirectory=这里填写你程序的安装目录
  • ExecStart=你程序的安装目录/cloudreve
  • 查看是否能启动服务: systemctl start cloudreve
  • 设置服务自动启动: systemctl enable cloudreve

管理命令

# 启动服务
systemctl start cloudreve
# 停止服务
systemctl stop cloudreve
# 重启服务
systemctl restart cloudreve
# 查看状态
systemctl status cloudreve