Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add systemd service if applicable for autostart #104

Closed
wants to merge 1 commit into from

Conversation

waywardone
Copy link

More recent versions of Raspbian use systemd to manage application starts.

  • Add OpenSprinkler.systemd - a systemd service template for OpenSprinkler
  • Update build.sh to install the systemd service if appropriate.

NOTE: The check for the directory /run/systemd/system may not be foolproof across distros but is a good enough check for the Raspberry Pi and Raspbian IMO.

@kpfleming
Copy link

Thanks for doing this; I'm about to do it as well, although I want to have the software running as a non-root user which complicates things somewhat.

@@ -0,0 +1,10 @@
[Unit]
Description=OpenSprinkler

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the following on my system to avoid network errors at boot time:

After=network-online.target
Wants=network-online.target

@WillCodeForCats
Copy link

I tried running as a non-root user at first (as user ospi group ospi) and it worked for the most part, except for the reboot function in the UI didn't work. I installed under /opt/ospi with the following unit file:

/etc/systemd/system/opensprinkler.service

[Unit]
Description=OpenSprinkler Raspberry Pi
After=network-online.target
Wants=network-online.target
 
[Service]
Type=exec
#User=ospi
#Group=ospi
Restart=on-failure
ExecStart=/opt/ospi/OpenSprinkler
WorkingDirectory=/opt/ospi

[Install]
WantedBy=multi-user.target

I didn't look to see how the reboot function is working in code to see if it could be modified to work at non-root.

@rayshobby
Copy link
Member

Thanks for the proposal. This has been addressed by the recent PR #295

@rayshobby rayshobby closed this Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants