ubuntu-16.04systemdupstartchef-template

Converting chef upstart template to systemd


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 -


Solution

  • Found the issue. It is because of the >> which I added for appending log. >> is considered an Operator in Systemd