Last active
July 9, 2019 03:27
-
-
Save ryanburnette/a008fc7bcebda4e7a7335d1f304c6cfe to your computer and use it in GitHub Desktop.
Notes on running NodeJs as a systemd service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=service | |
After=network.target | |
[Service] | |
Type=simple | |
User=ubuntu | |
WorkingDirectory=/opt/service | |
ExecStart=/bin/bash -c 'exec bin/node app.js 2>&1 >> logs/console.log' | |
Restart=always | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The last comment about logging isn't working as intended. It also requires that I use Ubuntu 18.04, which I don't have the ability to do in all my environments.
I'm going to try this approach next. https://www.axllent.org/docs/view/nodejs-service-with-systemd/#comment-3322013904