Last active
January 17, 2025 02:55
-
-
Save patoi/f725a9a39d0145bcda4c3796b6419db7 to your computer and use it in GitHub Desktop.
Using systemd for nodejs process with nvm
This file contains hidden or 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=Document Server Daemon | |
| [Service] | |
| Type=forking | |
| Environment=NODE_VERSION=12 | |
| WorkingDirectory=/home/your_user/your_node_app_dir | |
| ExecStart=/home/your_user/.nvm/nvm-exec npm start | |
| StandardOutput= | |
| User=your_user | |
| [Install] | |
| WantedBy=multi-user.target |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to install at least one Node.js version:
nvm install --ltsby your_user account ( https://github.com/nvm-sh/nvm ).First:
sudo suEdit:
nano /etc/systemd/system/docserver.serviceReload after editing:
systemctl daemon-reloadStart, stop, restart:
systemctl start|stop|restart docserver.serviceLog:
journalctl -fu docserver.service