I wanted Node.js to start automatically when Edison started.
First, create a configuration file
$ vi /etc/systemd/system/hoge.service
Contents of the configuration file
[Unit]
Description=Node.js Hoge-Server
[Service]
WorkingDirectory=/home/root/Documents/Project/hoge
Type=simple
ExecStart=/usr/bin/node app.js
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=node-server
[Install]
WantedBy=multi-user.target
$ systemctl start hoge.service
$ systemctl stop hoge.service
$ systemctl status hoge.service
Automatically start when the OS starts
$ systemctl enable hoge.service
Do not start automatically when the OS starts
$ systemctl disable hoge.service
http://enakai00.hatenablog.com/entry/20130917/1379374797
Recommended Posts