Advertisement
sxiii

Node-RED SystemD Unit

Mar 8th, 2023 (edited)
924
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.14 KB | None | 0 0
  1. # This script work on any system using systemd as the init process.
  2.  
  3. # To easily download, install and set at startup:
  4. # wget https://pastebin.com/raw/yMbPkcSG -O /etc/systemd/system/nodered.service && sudo systemctl --reload-daemon && sudo systemctl enable nodered
  5.  
  6. # To consult the log : journalctl -u nodered
  7. [Unit]
  8. Description=Node-RED is a tool for wiring together hardware devices, APIs and online services in new and interesting ways.
  9. After=syslog.target network.target
  10. Documentation=http://nodered.org/
  11.  
  12. [Service]
  13. Environment="NODE_OPTIONS=--max-old-space-size=128"
  14. Environment="NODE_RED_OPTIONS=-v"
  15. #Full Path to Node.js
  16. ExecStart=/usr/bin/node-red $NODE_OPTIONS flows.js $NODE_RED_OPTIONS
  17. WorkingDirectory=/home/dvb/node-red/
  18. # User/Group that launches node-RED (it's advised to create a new user for Node-RED)
  19. # You can do : sudo useradd node-red
  20. # then change the User=root by User=node-red
  21. User=user
  22. Group=user
  23. Nice=10
  24. SyslogIdentifier=Node-RED
  25. StandardOutput=syslog
  26. # Make Node-RED restart if it fails
  27. Restart=on-failure
  28. # Node-RED need a SIGINT to be notified to stop
  29. KillSignal=SIGINT
  30.  
  31. [Install]
  32. WantedBy=multi-user.target
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement