Zxilly
Try to be 1%
Zxilly's Blog

Systemd设置运行目录

摘要

使用WorkingDirectory来设置运行目录

起因

安装了MCSM来管理MC服务器,需要设置自动启动,于是决定使用Systemd来管理启动项 随后发现nodejs的文件都使用相对目录,无法直接启动 查询后使用WorkingDirectory来设置运行目录,解决问题

配置文件

[Unit]
Description=MCMS
Wants = network-online.target

After = network.target

[Service]
Type=simple
ExecStart=/usr/bin/env node /home/mcmanage/app.js
WorkingDirectory=/home/mcmanage
StandardOutput=syslog
StandardError=inherit

[Install]
WantedBy=multi-user.target

参考

[1]Node 应用的 Systemd 启动[2][systemd-devel] WorkingDirectory in service file

没有标签
首页      服务器      Systemd设置运行目录

Zxilly

文章作者

发表回复

textsms
account_circle
email

Zxilly's Blog

Systemd设置运行目录
摘要 使用WorkingDirectory来设置运行目录 起因 安装了MCSM来管理MC服务器,需要设置自动启动,于是决定使用Systemd来管理启动项 随后发现nodejs的文件都使用相对目录,无法直接启动 查询…
扫描二维码继续阅读
2019-06-11