centos daemon process node

Ado: 

we /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

 

start up:

// boot 
systemctl enable MEDIA- auth.service 

// start 
systemctl start media-auth.service

 

Test, normal, start to stop !!!

kill -9 {id} process

After the killing, the normal start ..   

perfect!

 

Guess you like

Origin www.cnblogs.com/signal/p/12565021.html