Reputation: 11
I have one upstart template in chef-Cookbook and want to convert it into Systemd so that it can be supported in 16.04. I have already converted but faced the issue as my server is not starting properly.
Below is the upstart script -
#!upstart
description "Server nodejs"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on [!12345]
console log
setuid root
setgid www-data
chdir /srv/
exec /usr/local/bin/node /srv/my_service/src/cli/index.js >>/var /log/my_service/my_service_nodejs.log 2>&1
Conversion of same in Systemd is -
[Unit]
Description=Server nodejs
After=network.target
[Service]
User=root
Group=www-data
WorkingDirectory=/srv/
ExecStart=/usr/local/bin/node /srv/my_service/src/cli/index.js >>/var/log/my_service/my_service_nodejs.log 2>&1
[Install]
WantedBy=multi-user.target
Issues I am facing -
Node js Server is not Running my_nodejs.service - Server nodejs Loaded: loaded (/etc/systemd/system/my_nodejs.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Thu 2017-12-28 08:01:14 UTC; 6s ago Main PID: 5842 (code=exited, status=64)
systemd[1]: my_nodejs.service: Main process exited, code=exited, status=64/n/a
Upvotes: 1
Views: 117