最近在折腾这种GO语言开发的程序,单一文件,下载下来直接运行就能使用,真心简洁强大。
但同时遇到一个问题,就是不能后台运行,不能开机启动。
所以这里收藏了一下cloudreve官方的进程守护教程,备查。
一、编辑配置文件
vim /usr/lib/systemd/system/cloudreve.service
这里的cloudreve.service可以自定义
二、粘贴如下内容,将 PATH_TO_CLOUDREVE 更换为程序所在目录
1 | [Unit] |
这里的Description、WorkingDirectory、ExecStart都需要自定义三、通过systemctl命令启动程序后台运行,并设置开机启动
systemctl daemon-reload # 更新配置
systemctl start cloudreve # 启动服务
systemctl enable cloudreve # 设置开机启动
systemctl disenable cloudreve # 禁用开机启动
四、systemctl命令常用功能
systemctl start cloudreve # 启动服务
systemctl stop cloudreve # 停止服务
systemctl restart cloudreve # 重启服务
systemctl status cloudreve # 查看状态

评论已关闭