OpenSprinkler Forums OpenSprinkler Unified Firmware Opensprinkler Pi and systemd (Raspbian Jessie) Reply To: Opensprinkler Pi and systemd (Raspbian Jessie)



OK, so this is what I did.

1) Build OSPi Firmware as per normal but select “No” when prompted to auto-start OpenSprinkler.

$ sudo ./ OSPI

2) Create a Systemd configuration file to control the start-up of OSPi

$ sudo nano /etc/systemd/system/ospi.service

3) Add the following lines to the ospi.service file and then save the file

Description=OpenSprinkler Server
# After=weather.service apache2.service

# ExecStart=/usr/bin/stdbuf -oL /home/peter/OpenSprinklerGen2/OpenSprinkler


Note that in my setup, I need OSPi to wait until I have started the web server and weather service as I host these on my local RPi. Also, I use “stdbuf” to set the output from OSPi to be line buffered (i.e. -oL) so that diagnostic output is written immediately to the journal log file. Both of these may be unnecessary for you so have commented out. You will need to adjust the directories to your OSPi directory location.

4) Initialise the service and set to auto-start

$ sudo systemctl enable ospi.service
$ sudo systemctl start ospi.service

5) You can check that the service is running successfully with the systemctl command

$ systemctl status ospi.service

That should be it.