Another way to auto start openLuup on reboots using systemctl on a Raspberry Pi 3
I've had various degrees of successes (mainly unpredictable problems) with other projects on Raspberry Pi's with restarting programs with rc.local and crontabs. Typically it has related to when the network becomes available during the boot process. systemd has been more predictable for me. Here is how I set it up for openluup on a raspberry pi 3.
This assumes you installed openLuup at: /etc/cmh-ludl
Create a bash script to run openLuup in the background:
sudo nano /etc/cmh-ludl/run_openLuup.sh
#!/bin/bash
echo "Starting openLuup server"
echo "To see tail of logfile: tail -f ./out.log"
cd /etc/cmh-ludl
sudo rm ./out.log
nohup ./openLuup_reload >> out.log 2>&1 &
sudo chmod +x run_openLuup.sh
Next create the systemd service for openLuup setting it up to wait for network before starting
sudo nano /etc/systemd/system/openluup.service
[Unit]
Description=openLuup and AltUI Server for Vera 3
Wants=network.target
After=network.target
[Service]
Type=forking
WorkingDirectory=/etc/cmh-ludl
ExecStart=/bin/bash /etc/cmh-ludl/run_openLuup.sh
[Install]
WantedBy=multi-user.target
Next (one time only) create the service and start openLuup. Make sure openLuup server is stopped using
http://openLuupIP:3480/data_request?id=exit sudo systemctl enable openluup
sudo systemctl start openluup
That's it. openLuup will now autostart with reboots.
Other useful commands:
sudo systemctl status openluup -l
sudo systemctl stop openluup
sudo systemctl disable openluup