Skip to content

Add systemd support - #60

Merged
thiagoralves merged 2 commits into
mainfrom
development
Dec 31, 2025
Merged

Add systemd support#60
thiagoralves merged 2 commits into
mainfrom
development

Conversation

@thiagoralves

Copy link
Copy Markdown
Contributor

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:

  • Added a comprehensive has_systemd_support() function to reliably detect if systemd is available and running as PID 1, including checks for systemctl presence and operational status.
  • Introduced install_systemd_service() to create and enable a openplc-runtime.service systemd unit, ensuring the runtime starts on boot and can be managed via standard systemd commands.
  • Updated the installation flow to automatically install and start the systemd service if systemd support is detected, with fallback instructions for manual start if not.

User experience improvements:

  • Enhanced post-installation output to inform users about the systemd service status and provide useful management commands, or fallback instructions for manual execution.
  • Ensured the installation marker .installed is created before starting the service for accurate state tracking.

devin-ai-integration Bot and others added 2 commits December 31, 2025 07:00
- 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
@thiagoralves
thiagoralves merged commit 3287add into main Dec 31, 2025
2 checks passed
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.

1 participant