<p>I find Node-RED really amazing but the lack of being able to manage it as a daemon quite annoyed me&period;<&sol;p>&NewLine;<p>I created an init script and a systemd unit configuration to be able to manage Node-RED as any service on my Raspberry Pi&period;<&sol;p>&NewLine;<p><span id&equals;"more-105"><&sol;span><&sol;p>&NewLine;<h1>Init&period;d<&sol;h1>&NewLine;<script src&equals;"https&colon;&sol;&sol;gist&period;github&period;com&sol;cf91100f81f2b37b3e94&period;js"><&sol;script><noscript><pre><code class&equals;"language-shell shell">&num;&excl;&sol;bin&sol;bash&NewLine;&num;&num;&num; BEGIN INIT INFO&NewLine;&num; Provides&colon; node-red&NewLine;&num; Required-Start&colon; &dollar;local&lowbar;fs &dollar;remote&lowbar;fs &dollar;network&NewLine;&num; Required-Stop&colon; &dollar;local&lowbar;fs &dollar;remote&lowbar;fs &dollar;network&NewLine;&num; Default-Start&colon; 2 3 4 5&NewLine;&num; Default-Stop&colon; 0 1 6&NewLine;&num; Short-Description&colon; Start or stop the node-red server&NewLine;&num;&num;&num; END INIT INFO&NewLine;&num; Can be downloaded and installed in one go by using this command&NewLine;&num; sudo wget -O &sol;tmp&sol;download https&colon;&sol;&sol;gist&period;github&period;com&sol;Belphemur&sol;cf91100f81f2b37b3e94&sol;download &amp&semi;&amp&semi; sudo tar -zxf &sol;tmp&sol;download --strip-components 1 -C &sol;etc&sol;init&period;d &amp&semi;&amp&semi; sudo chmod &plus;x &sol;etc&sol;init&period;d&sol;node-red &amp&semi;&amp&semi; sudo update-rc&period;d node-red defaults&NewLine;&NewLine;&num; User that launches node-RED &lpar;it&&num;039&semi;s advised to create a new user for Node-RED&rpar;&NewLine;&num; You can do &colon; sudo useradd node-red&NewLine;&num; then change the USER&equals;root by USER&equals;node-red&NewLine;&num; if you change the user&comma; don&&num;039&semi;t forget to also change the ownership of the log file &lpar;and create it if it doesn&&num;039&semi;t exist&rpar;&colon;&NewLine;&num; sudo chown NEWUSER &sol;var&sol;log&sol;node-red&period;log&NewLine;&num; else the log won&&num;039&semi;t be writtable&NewLine;USER&equals;root&NewLine;&NewLine;&num; The location of Node-RED configuration&comma; not mandatory&comma; leave empty&sol;commented to let &NewLine;&num; Node-RED decides&period;&NewLine;&NewLine;&num;USER&lowbar;DIR&equals;&&num;039&semi;&sol;home&sol;pi&sol;node-red&sol;&&num;039&semi;&NewLine;&NewLine;&NewLine;&num; DONT&&num;039&semi;T CHANGE unless you know what you&&num;039&semi;re doing&NewLine;NAME&equals;node-red&NewLine;DAEMON&equals;&sol;usr&sol;local&sol;bin&sol;node-red-pi&NewLine;OPTIONS&equals;&quot&semi;--max-old-space-size&equals;128&quot&semi;&NewLine;&NewLine;if &lbrack; -n &quot&semi;&dollar;USER&lowbar;DIR&quot&semi; &rsqb;&semi; then&NewLine;&Tab;OPTIONS&equals;&quot&semi;&dollar;OPTIONS --userDir&equals;&dollar;USER&lowbar;DIR&quot&semi;&NewLine;fi&NewLine;&NewLine;LOG&equals;&&num;039&semi;&sol;var&sol;log&sol;node-red&period;log&&num;039&semi;&NewLine;&NewLine;PIDFILE&equals;&sol;var&sol;run&sol;node-red&period;pid&NewLine;&NewLine;&period; &sol;lib&sol;lsb&sol;init-functions&NewLine;&NewLine;start&lowbar;daemon &lpar;&rpar; &lbrace;&NewLine; start-stop-daemon --start --background &bsol;&NewLine; --chuid &dollar;USER --name &dollar;NAME &bsol;&NewLine; &dollar;START&lowbar;STOP&lowbar;OPTIONS --make-pidfile --pidfile &dollar;PIDFILE &bsol;&NewLine; --startas &sol;bin&sol;bash -- -c &quot&semi;exec &dollar;DAEMON &dollar;OPTIONS &gt&semi;&gt&semi; &dollar;LOG 2&gt&semi;&amp&semi;1&quot&semi;&NewLine; log&lowbar;end&lowbar;msg 0&NewLine;&rcub;&NewLine;&NewLine;case &quot&semi;&dollar;1&quot&semi; in&NewLine; start&rpar;&NewLine; log&lowbar;daemon&lowbar;msg &quot&semi;Starting daemon&quot&semi; &quot&semi;&dollar;NAME&quot&semi;&NewLine; start&lowbar;daemon&NewLine;&NewLine; &semi;&semi;&NewLine; stop&rpar;&NewLine; log&lowbar;daemon&lowbar;msg &quot&semi;Stopping daemon&quot&semi; &quot&semi;&dollar;NAME&quot&semi;&NewLine; start-stop-daemon --stop --quiet &bsol;&NewLine; --chuid &dollar;USER &bsol;&NewLine; --exec &dollar;DAEMON --pidfile &dollar;PIDFILE --retry 30 &bsol;&NewLine; --oknodo &vert;&vert; log&lowbar;end&lowbar;msg &dollar;&quest;&NewLine; log&lowbar;end&lowbar;msg 0&NewLine; &semi;&semi;&NewLine; restart&rpar;&NewLine;&Tab;&Tab;&Tab;&dollar;0 stop&NewLine;&Tab;&Tab;&Tab;sleep 5&NewLine;&Tab;&Tab;&Tab;&dollar;0 start&NewLine;&Tab;&Tab;&semi;&semi;&NewLine;&Tab;&Tab;status&rpar;&NewLine; status&lowbar;of&lowbar;proc &quot&semi;&dollar;DAEMON&quot&semi; &quot&semi;&dollar;NAME&quot&semi;&NewLine; exit &dollar;&quest;&NewLine; &semi;&semi;&NewLine;&NewLine; &ast;&rpar;&NewLine; echo &quot&semi;Usage&colon; &dollar;0 &lbrace;start&vert;stop&vert;restart&rcub;&quot&semi;&NewLine; exit 1&NewLine;esac&NewLine;exit 0&NewLine;<&sol;code><&sol;pre><&sol;noscript>&NewLine;<h1>systemd<&sol;h1>&NewLine;<script src&equals;"https&colon;&sol;&sol;gist&period;github&period;com&sol;3f6d3bf211b0e8a18d93&period;js"><&sol;script><noscript><pre><code class&equals;"language-desktop desktop">&num; This script work on any system using systemd as the init process&period;&NewLine;&num; It works on Debian&sol;Raspbian Jessie&period;&NewLine;&num; If you have Debian&sol;Rapbian Wheezy and want to use this script with systemd &NewLine;&num; follow the information here &colon; https&colon;&sol;&sol;wiki&period;debian&period;org&sol;systemd&NewLine;&NewLine;&num; To easily download&comma; install and set at startup&colon;&NewLine;&num; wget -O &sol;tmp&sol;download https&colon;&sol;&sol;gist&period;github&period;com&sol;Belphemur&sol;3f6d3bf211b0e8a18d93&sol;download &amp&semi;&amp&semi; sudo tar -zxf &sol;tmp&sol;download --strip-components 1 -C &sol;etc&sol;systemd&sol;system&sol; &amp&semi;&amp&semi; sudo systemctl --reload-daemon &amp&semi;&amp&semi; sudo systemctl enable Node-RED&NewLine;&NewLine;&num; To consult the log &colon; journalctl -u Node-RED&NewLine;&lbrack;Unit&rsqb;&NewLine;Description&equals;Node-RED is a tool for wiring together hardware devices&comma; APIs and online services in new and interesting ways&period;&NewLine;After&equals;syslog&period;target network&period;target&NewLine;Documentation&equals;http&colon;&sol;&sol;nodered&period;org&sol;&NewLine;&NewLine;&lbrack;Service&rsqb;&NewLine;Environment&equals;&quot&semi;NODE&lowbar;OPTIONS&equals;--max-old-space-size&equals;128&quot&semi;&NewLine;Environment&equals;&quot&semi;NODE&lowbar;RED&lowbar;OPTIONS&equals;-v&quot&semi;&NewLine;&num;Full Path to Node&period;js&NewLine;ExecStart&equals;&sol;usr&sol;local&sol;bin&sol;node &dollar;NODE&lowbar;OPTIONS red&period;js &dollar;NODE&lowbar;RED&lowbar;OPTIONS&NewLine;WorkingDirectory&equals;&sol;home&sol;pi&sol;node-red&sol;&NewLine;&num; User&sol;Group that launches node-RED &lpar;it&&num;039&semi;s advised to create a new user for Node-RED&rpar;&NewLine;&num; You can do &colon; sudo useradd node-red&NewLine;&num; then change the User&equals;root by User&equals;node-red&NewLine;User&equals;root&NewLine;Group&equals;root&NewLine;Nice&equals;10&NewLine;SyslogIdentifier&equals;Node-RED&NewLine;StandardOutput&equals;syslog&NewLine;&num; Make Node-RED restart if it fails&NewLine;Restart&equals;on-failure&NewLine;&num; Node-RED need a SIGINT to be notified to stop&NewLine;KillSignal&equals;SIGINT&NewLine;&NewLine;&lbrack;Install&rsqb;&NewLine;WantedBy&equals;multi-user&period;target&NewLine;<&sol;code><&sol;pre><&sol;noscript>&NewLine;<p>&nbsp&semi;<&sol;p>&NewLine;