new-api.service 514 B

123456789101112131415161718
  1. # File path: /etc/systemd/system/new-api.service
  2. # sudo systemctl daemon-reload
  3. # sudo systemctl start new-api
  4. # sudo systemctl enable new-api
  5. # sudo systemctl status new-api
  6. [Unit]
  7. Description=One API Service
  8. After=network.target
  9. [Service]
  10. User=ubuntu # 注意修改用户名
  11. WorkingDirectory=/path/to/new-api # 注意修改路径
  12. ExecStart=/path/to/new-api/new-api --port 3000 --log-dir /path/to/new-api/logs # 注意修改路径和端口号
  13. Restart=always
  14. RestartSec=5
  15. [Install]
  16. WantedBy=multi-user.target