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

Use systemd unit file for service management #3

Open
geerlingguy opened this issue Sep 22, 2022 · 2 comments
Open

Use systemd unit file for service management #3

geerlingguy opened this issue Sep 22, 2022 · 2 comments

Comments

@geerlingguy
Copy link
Contributor

Instead of using rc.local and recompiling the binary every reboot, it seems like it may be more efficient to use systemd to manage the LCD display service.

That's what I did by creating the following unit file at /usr/lib/systemd/system/lcd_display.service:

[Unit]
Description=LCD Library

[Service]
WorkingDirectory=/opt/SKU_RM0004
ExecStart=/opt/SKU_RM0004/display
Restart=always

[Install]
WantedBy=multi-user.target

Then I ran sudo systemctl daemon-reload to reload the daemon, sudo systemctl start lcd_display to start the display, and sudo systemctl enable lcd_display to make sure it starts at boot.

This setup assumes you're running the latest version of Raspberry Pi OS, Debian 11, or Ubuntu 20.04 or later.

@TiVoHomeUser
Copy link

Nice Thanks
You may be interested in my branch https://github.com/TiVoHomeUser/SKU_RM0004 I added a trap that blanks the screen on shutdown.
I also added some status color to the display info

@gemini0672
Copy link

Thanks, this also worked perfect on the Raspberry PI 4B running Fedora 37 as well.

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

No branches or pull requests

3 participants