Skip to content

Instantly share code, notes, and snippets.

@s-light
Last active April 28, 2022 16:55
Show Gist options
  • Save s-light/fba54aa65b14a1da290f10dfa4e9dcae to your computer and use it in GitHub Desktop.
Save s-light/fba54aa65b14a1da290f10dfa4e9dcae to your computer and use it in GitHub Desktop.
olad systemd service file
# based on examples found at
# https://learn.adafruit.com/running-programs-automatically-on-your-tiny-computer/systemd-writing-and-enabling-a-service
# https://medium.com/@johannes_gehrs/getting-started-with-systemd-on-debian-jessie-e024758ca63d
# https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
# https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Before=
# https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Wants=
# copy to target with:
# sudo cp olad.service /etc/systemd/system/
# enable service
# sudo systemctl enable olad.service
# start
# sudo systemctl start olad.service
# check status
# sudo systemctl status olad.service
# disable service
# sudo systemctl disable olad.service
# remove service file:
# sudo rm /etc/systemd/system/olad.service
[Unit]
Description=OLAD Open Lighting Architecture daemon
# wants would mean if this unit is started it also starts the wanted unit.
# we don't need this because device_manager itself starts this unit explicitly if its time.
# Wants=device_manager.service
# After means that this unit only starts if the listed unit is started
After=network.target
[Service]
# Type=simple is default
Type=simple
# run as user
User=YOURUSERNAME
# commandline
ExecStart=/usr/local/bin/olad -c /home/YOURUSERNAME/somepathto/config/
# redirect standard output to
StandardOutput=null
# if process exits (with fail or success) restart it.
Restart=always
[Install]
# start with system.
WantedBy=multi-user.target
Alias=olad.service
@s-light
Copy link
Author

s-light commented Jun 6, 2018

it works for me on a arietta board with an debian system build as in my note
but i never have tested it on a RPI image..

@SummerSeaSun
Copy link

Works fine with latest raspberry pi OS. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment