[Unit]
Description=描述
After=syslog.target network.target remote-fs.target nss-lookup.target
 
[Service]
Type=simple
WorkingDirectory=程序路径
User=root
ExecStart=/bin/sh -c "exec 执行程序(例:npm run xxx) >> 输出文件(例:xxx.log) 2>&1"
PrivateTmp=true
 
[Install]
WantedBy=multi-user.target

放在/etc/systemd/system目录下即可用systemctl start/stop命令启动停止服务了 (需要chmod授权一下)

 

相关文章:

  • 2021-06-08
  • 2021-11-06
  • 2021-08-04
  • 2022-12-23
  • 2021-12-09
  • 2021-07-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-08
  • 2022-12-23
  • 2022-01-02
  • 2021-08-01
相关资源
相似解决方案