Skip to content

Run node-spb-mqtt.js as a service #1

@mauriceflier

Description

@mauriceflier

On ubuntu, o make this js run in the background i've created a .service file and placed it in /etc/systemd/system
Next I placed the application folder in /var/opt/node-spc-mqtt.

node-spc-mqtt.service

[Unit]
Description=SPC Gateway MQTT module



[Service]
ExecStart=/var/opt/node-spc-mqtt/node-spc-mqtt.js

Restart=always
User=administrator
# Note Debian/Ubuntu uses 'nogroup', RHEL/Fedora uses 'nobody'
Group=nogroup
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
WorkingDirectory=/var/opt/node-spc-mqtt

[Install]
WantedBy=multi-user.target
systemctl enable node-spc-mqtt.service
systemctl start node-spc-mqtt.service

Maybe it's an idea to create embed something like this by default.
#https://stackoverflow.com/questions/4018154/how-do-i-run-a-node-js-app-as-a-background-service

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions