Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nodejs安装并使用systemd配置进程守护应该怎么设置二级目录(API_ROOT=$PATH)? #82

Open
n2aod opened this issue Sep 23, 2024 · 0 comments

Comments

@n2aod
Copy link

n2aod commented Sep 23, 2024

这样对吗?但是我应该怎么配置二级目录(API_ROOT=$PATH)?

# 克隆储存库到本地
git clone https://github.com/easychen/CookieCloud.git

# 将主文件夹复制到工作目录
mkdir -p /data/cookiecloud ; cp -r ./CookieCloud /data/CookieCloud

# 安装依赖文件
npm install --prefix /data/CookieCloud/api

# 设置进程守护(systemd)
cat > /usr/lib/systemd/system/cookiecloud.service << EOF
[Unit]
Description=CookieCloud
Documentation=https://github.com/easychen/CookieCloud
After=network.target

[Service]
WorkingDirectory=/data/CookieCloud/api
ExecStart=/usr/bin/node /data/CookieCloud/api/app.js
Restart=on-abnormal
RestartSec=5s
StandardOutput=null
StandardError=syslog

[Install]
WantedBy=multi-user.target
EOF

# 更新配置
systemctl daemon-reload

# 启动服务
systemctl start cookiecloud

# 设置开机启动
systemctl enable cookiecloud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant