-
Notifications
You must be signed in to change notification settings - Fork 29
Automatically start at boot
These steps were written to work on a low-memory (512mb) Raspberry Pi Zero W.
These same general steps should work on any Linux distribution that includes systemd with only minor changes, explained below.
This will launch dashPanel at every boot.
dashpanel
will wait its turn for a service called poolcontroller
(aka: nodejs-PoolController) to launch on boot before it does.
(You'll want to set up systemd for poolController first.)
If dashPanel crashes, it'll restart itself.
First, make a systemd service for dashPanel:
sudo nano /etc/systemd/system/dashpanel.service
Into this file, paste:
[Unit]
Description=NodeJS Pool Controller Dash Panel
Documentation=https://github.com/rstrouse/nodejs-poolController-dashPanel
After=poolcontroller.service
[Service]
Environment=NODE_ENV=production
Type=simple
User=pi
WorkingDirectory=/home/pi/nodejs-poolController-dashPanel/
ExecStart=/usr/bin/node dist/app.js
Restart=on-failure
RestartSec=15s
[Install]
WantedBy=multi-user.target
Notes:
- Change the
WorkingDirectory
to wherever you've put dashPanel's files. - Some people have node installed in
/usr/bin/local/
instead of/usr/bin/
so change that line if needed. - If you have a more powerful machine, replace the ExecStart line with:
ExecStart=/usr/bin/npm start
. Again, npm may live in/usr/bin/local/
, so make certain you've got the right entry there.
After you've saved the file, reload systemd so it can see the changes:
sudo systemctl -q daemon-reload
Now enable the service to run on boot and start it right now:
sudo systemctl enable --now -q dashpanel
If nothing's coming up in a browser, view logs:
journalctl -f -u dashpanel
And start the service manually in another terminal to see what's going on:
sudo systemctl start dashpanel