Add systemd support - #60
Merged
Merged
Conversation
- Add has_systemd_support() function to detect if systemd is available - Checks for systemctl command - Verifies /run/systemd/system directory exists - Confirms PID 1 is systemd (handles Docker/GitHub Actions) - Tests communication with systemd via show-environment - Add install_systemd_service() function to create and enable service - Creates /etc/systemd/system/openplc-runtime.service - Runs daemon-reload and enables service with --now flag - Service runs start_openplc.sh as root - Update installation completion message - Shows systemctl commands when service is installed - Falls back to manual start instructions when systemd unavailable This allows native Linux installations to automatically start the runtime on boot while gracefully skipping service installation in Docker containers and GitHub Actions environments. Co-Authored-By: Thiago Alves <thiagoralves@gmail.com>
…md-service Add systemd service support to installer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request enhances the installation process for OpenPLC Runtime by adding robust systemd service detection and automated service installation. The script now checks for systemd support in a reliable way and, if available, installs and starts the OpenPLC Runtime as a systemd service, providing users with clear instructions and status updates.
Systemd service integration:
has_systemd_support()function to reliably detect if systemd is available and running as PID 1, including checks for systemctl presence and operational status.install_systemd_service()to create and enable aopenplc-runtime.servicesystemd unit, ensuring the runtime starts on boot and can be managed via standard systemd commands.User experience improvements:
.installedis created before starting the service for accurate state tracking.