centos 守护 node 进程

废话不多说: 

vi /usr/lib/systemd/system/media-auth.service

 

[Unit]
Description=media-auth server daemon
Documentation=no
After=no
Wants=no

[Service]
EnvironmentFile=no
ExecStart=/usr/bin/node /root/MediaAuth/index.js
ExecReload=/bin/kill -HUP $MAINPID
ExecStop=/bin/kill -9 $MAINPID
KillMode=process
Restart=on-failure
RestartSec=1s

[Install]
WantedBy=multi-user.target

 

启动:

// 开机启动
systemctl enable media-auth.service

// 启动
systemctl start media-auth.service

 

测试一下,正常,启动停止!!!

kill -9  {进程id}

杀后,正常启动..   

完美!

 

posted @ 2020-03-25 11:42  睡觉的虫  阅读(469)  评论(0编辑  收藏  举报