{"id":26608140,"url":"https://github.com/mobydeck/systemctl-alpine","last_synced_at":"2026-04-24T11:10:22.306Z","repository":{"id":281408590,"uuid":"945185622","full_name":"mobydeck/systemctl-alpine","owner":"mobydeck","description":"Manage systemd services on Alpine Linux","archived":false,"fork":false,"pushed_at":"2025-12-28T23:34:26.000Z","size":51,"stargazers_count":14,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-31T17:23:28.935Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mobydeck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-08T21:14:40.000Z","updated_at":"2025-12-28T23:33:01.000Z","dependencies_parsed_at":"2025-03-08T22:34:20.132Z","dependency_job_id":null,"html_url":"https://github.com/mobydeck/systemctl-alpine","commit_stats":null,"previous_names":["mobydeck/systemctl-alpine"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/mobydeck/systemctl-alpine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobydeck%2Fsystemctl-alpine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobydeck%2Fsystemctl-alpine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobydeck%2Fsystemctl-alpine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobydeck%2Fsystemctl-alpine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mobydeck","download_url":"https://codeload.github.com/mobydeck/systemctl-alpine/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobydeck%2Fsystemctl-alpine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32220427,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T10:26:35.452Z","status":"ssl_error","status_checked_at":"2026-04-24T10:25:27.643Z","response_time":64,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-23T23:38:16.673Z","updated_at":"2026-04-24T11:10:17.294Z","avatar_url":"https://github.com/mobydeck.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# systemctl-alpine \nβ _(beta)_\n\n[![Go Version](https://img.shields.io/github/go-mod/go-version/mobydeck/systemctl-alpine)](https://golang.org/doc/devel/release.html)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nA CLI tool that helps you manage services on Alpine Linux by translating systemd commands to their OpenRC equivalents.\n\n## Overview\n\n`systemctl-alpine` bridges the gap between systemd and OpenRC service management by providing a familiar systemd-like interface for Alpine Linux. It allows you to:\n\n- Convert systemd service files to OpenRC init scripts\n- Enable and disable services\n- Start, stop, restart, and check the status of services\n- Check if services are active and view their detailed properties\n- List all available services and their status (both enabled and installed)\n- Query service states and properties in a systemd-compatible way\n- Edit OpenRC service scripts with modification tracking\n- Work with template services (e.g., `nginx@.service`)\n\nThis tool is particularly useful for:\n- Docker container images transitioning from systemd-based distributions to Alpine Linux\n- Developers familiar with systemd who need to work with Alpine Linux\n- Automation scripts that use systemd commands but need to run on Alpine\n\n## Installation\n\n## Prerequisites\n\n- Go 1.24 or higher\n- Alpine Linux (tested on version 3.20 and above)\n- Root/sudo access for service management\n\n### From Source\n\nClone the repository\n\n```bash\ngit clone https://github.com/mobydeck/systemctl-alpine.git\ncd systemctl-alpine\n```\n\nBuild the binary\n\n```bash\ngo build -o systemctl-alpine\n```\n\nInstall it to your PATH\n\n```bash\nsudo mv systemctl-alpine /bin/systemctl\n```\n\n### Usage\n\n```\nsystemctl is a CLI tool that helps you manage services on Alpine Linux\nby translating systemctl commands to their OpenRC equivalents.\n\nFor example, you can use 'systemctl enable some-service' to convert a systemd\nservice file to an OpenRC init script and enable it to start at boot.\n\nUsage:\n  systemctl [command]\n\nAvailable Commands:\n  completion      Generate the autocompletion script for the specified shell\n  daemon-reload   Reload systemd manager configuration (not needed in OpenRC)\n  disable         Disable one or more services from starting at boot\n  edit            Edit an OpenRC service script\n  enable          Enable one or more services to start at boot\n  help            Help about any command\n  is-active       Check if a service is currently active (running)\n  is-enabled      Check if a service is enabled to start at boot\n  list            List all systemd services and their OpenRC status\n  list-unit-files List all installed unit files and their enablement state\n  list-units      List loaded systemd units\n  reload          Reload a service\n  restart         Restart a service\n  show            Show properties of a service or the service manager\n  start           Start a service\n  status          Check the status of a service\n  stop            Stop a service\n\nFlags:\n  -h, --help   help for systemctl\n\nUse \"systemctl [command] --help\" for more information about a command.\n```\n\nEnable a service (converts systemd service file to OpenRC and enables it)\n\n```bash\nsystemctl enable nginx\n```\n\nEnable a template service with an instance name\n\n```bash\nsystemctl enable nginx@user1\n```\n\nEnable and start a service\n\n```bash\nsystemctl enable --now nginx\n```\n\nForce enable a service (overwrite manually modified service files)\n\n```bash\nsystemctl enable --force nginx\n```\n\nStart a service\n\n```bash\nsystemctl start nginx\n```\n\nStop a service\n\n```bash\nsystemctl stop nginx\n```\n\nRestart a service\n\n```bash\nsystemctl restart nginx\n```\n\nCheck service status\n\n```bash\nsystemctl status nginx\n```\n\nReload service configuration\n\n```bash\nsystemctl reload nginx\n```\n\nDisable a service\n\n```bash\nsystemctl disable nginx\n```\n\nDisable and stop a service\n\n```bash\nsystemctl disable --now nginx\n```\n\nCheck if a service is enabled\n\n```bash\nsystemctl is-enabled nginx\n```\n\nCheck if a service is currently active (running)\n\n```bash\nsystemctl is-active nginx\n```\n\nShow service properties\n\n```bash\nsystemctl show nginx\n```\n\nShow specific properties of a service\n\n```bash\nsystemctl show nginx -p ActiveState\nsystemctl show nginx --property=UnitFileState --property=Type\nsystemctl show nginx --property=ActiveState --value\n```\n\nShow systemd manager properties\n\n```bash\nsystemctl show\n```\n\nEdit a service script\n\n```bash\nsystemctl edit nginx\n```\n\nList services\n\n```bash\n# List enabled OpenRC services and all systemd services\nsystemctl list\n\n# List all services including disabled OpenRC services\nsystemctl list --all\nsystemctl ls -a\n\n# The output shows service status and origin for converted services\nSERVICE                        STATUS\nnginx                          enabled\nredis                          enabled (from /lib/systemd/system/redis.service)\nmysql                          disabled\napache2                        disabled (not converted)\n```\n\nList unit files\n\n```bash\n# List all installed unit files with their enablement state\nsystemctl list-unit-files\n\n# List only enabled service unit files\nsystemctl list-unit-files --type=service --state=enabled\n\n# The output shows each unit file and its state\nUNIT FILE                          STATE\nnginx.service                      enabled\nredis.service                      enabled\nmysql.service                      disabled\ncustom.service                     static\n```\n\nList units\n\n```bash\n# List all active and enabled units\nsystemctl list-units\n\n# List all units including inactive ones\nsystemctl list-units --all\n\n# List only failed units\nsystemctl list-units --state=failed\n\n# List only running services\nsystemctl list-units --type=service --state=running\n\n# The output shows detailed status of each unit\nUNIT                    LOAD      ACTIVE    SUB       DESCRIPTION\nnginx.service           loaded    active    running   nginx web server\nredis.service           loaded    active    running   Redis data structure store\nmysql.service           loaded    inactive  dead      MySQL database server\n```\n\n### Working with Multiple Services\n\nYou can enable or disable multiple services at once:\n\nEnable multiple services\n\n```bash\nsystemctl enable nginx mysql redis\n```\n\nEnable and start multiple services\n\n```bash\nsystemctl enable --now nginx mysql redis\n```\n\nDisable multiple services\n\n```bash\nsystemctl disable nginx mysql redis\n```\n\nDisable and stop multiple services\n\n```bash\nsystemctl disable --now nginx mysql redis\n```\n\n### Service File Locations\n\nThe tool looks for systemd service files in these locations:\n- `/lib/systemd/system/`\n- `/etc/systemd/system/`\n\n## How It Works\n\nWhen you run `systemctl enable some-service`:\n\n1. The tool looks for `some-service.service` in the standard systemd locations\n2. If a systemd service file is found:\n   - It parses the systemd service file and extracts key configuration\n   - It generates an equivalent OpenRC init script\n   - It installs the script to `/etc/init.d/some-service`\n3. If no systemd service file is found but an OpenRC service exists:\n   - It skips the conversion step and just enables the existing OpenRC service\n4. It enables the service using `rc-update add some-service default`\n5. If the `--now` flag is used, it also starts the service\n\nFor template services like `nginx@.service`, when you run `systemctl enable nginx@user1`:\n\n1. The tool looks for the template service file `nginx@.service`\n2. It processes the template, substituting variables like `%i` with the instance name `user1`\n3. It creates an OpenRC service script named `nginx@user1` with the instance name available as an environment variable\n\nFor other commands like `start`, `stop`, etc., it translates them to the appropriate `rc-service` commands.\n\n### Editing and Modification Protection\n\nWhen you run `systemctl edit some-service`:\n\n1. The tool opens the OpenRC service script in an editor (using `$EDITOR`, `vi`, `nano`, or `ed`)\n2. After editing, it adds a modification comment with a timestamp to track changes\n3. If you edit the file again, it updates the timestamp to reflect the most recent edit\n\nWhen you run `systemctl enable some-service` on a service that has been manually edited:\n\n1. The tool detects the modification comment and avoids overwriting your changes\n2. It notifies you that the service has been manually modified\n3. It enables the existing service without converting it again\n4. If you want to force a conversion, you can use the `--force` flag\n\nThis protection ensures that your manual customizations to service scripts are preserved.\n\n## Features\n\n- **Service Conversion**: Converts systemd service files to OpenRC init scripts\n- **ExecStop Support**: Properly handles custom stop commands from systemd services\n- **Reload Support**: Implements service reloading via SIGHUP\n- **Multiple Service Management**: Enable or disable multiple services with a single command\n- **Smart Listing**: Shows all systemd services and enabled OpenRC services by default, with an option to show all services\n- **Service State Querying**: Check if services are active or view their detailed properties (`is-active`, `show`)\n- **Unit File Inspection**: List all installed unit files with their enablement state (`list-unit-files`)\n- **Unit Listing**: Display loaded and active units with comprehensive status information (`list-units`)\n- **Existing Service Detection**: Works with existing OpenRC services even without systemd service files\n- **Service Type Support**: Handles different systemd service types (simple, forking, notify)\n- **Capabilities Support**: Converts systemd AmbientCapabilities to OpenRC capabilities\n- **Edit Command**: Edit OpenRC service scripts with your preferred editor\n- **Modification Protection**: Prevents automatic overwriting of manually edited service scripts\n- **Template Services**: Supports systemd template services with instance names and variable substitution\n- **Property Inspection**: View service properties in systemd-compatible key=value format with filtering options\n\n### Supported Systemd Service Directives\n\nThe following systemd service directives are supported in the conversion process:\n\n| Systemd Directive | OpenRC Equivalent | Notes |\n|-------------------|-------------------|-------|\n| Description | description | Service description |\n| User | command_user | User to run the service as |\n| Group | command_user | Group to run the service as (combined with User) |\n| WorkingDirectory | directory | Directory to run the service in |\n| EnvironmentFile | Sourced in script | Environment file for the service |\n| Environment | export statements | Environment variables |\n| ExecStartPre | start_pre() | Commands to run before starting the service |\n| ExecStart | command/command_args | Main service command |\n| ExecStop | stop() | Custom stop command |\n| Type | command_background | Affects whether service runs in background |\n| AmbientCapabilities | capabilities | Linux capabilities for the service |\n\n#### Service Type Handling\n\n- `Type=simple` or `Type=notify` (or no Type): Sets `command_background=true` in OpenRC\n- `Type=forking`: Omits `command_background` as the service handles its own daemonization\n\n#### Capabilities Handling\n\nSystemd's space-separated capabilities list is converted to OpenRC's comma-separated format with the `^` prefix:\n\n```\n# Systemd\nAmbientCapabilities=CAP_NET_BIND_SERVICE CAP_SYS_TIME\n\n# Converted to OpenRC\ncapabilities=\"^cap_net_bind_service,^cap_sys_time\"\n```\n\n#### Template Service Substitutions\n\nWhen processing template services, the following systemd specifiers are supported:\n\n| Specifier | Description | Example |\n|-----------|-------------|---------|\n| `%i` | Instance name | For `nginx@user1`, this is `user1` |\n| `%I` | Unescaped instance name | Same as `%i` but with systemd escaping undone |\n| `%p` | Prefix name | For `nginx@user1`, this is `nginx` |\n| `%P` | Unescaped prefix name | Same as `%p` but with systemd escaping undone |\n| `%n` | Full unit name | For `nginx@user1`, this is `nginx@user1.service` |\n| `%N` | Unit name without type suffix | For `nginx@user1.service`, this is `nginx@user1` |\n| `%a` | Architecture | `x86_64`, `aarch64`, etc. |\n| `%l` | Short hostname | Hostname without domain part |\n| `%m` | Machine ID | Contents of `/etc/machine-id` |\n| `%o` | Operating system ID | From `/etc/os-release`, e.g., `alpine` |\n| `%%` | Percent sign | Literal `%` character |\n\nThe instance name is also made available as the `INSTANCE` environment variable in the OpenRC script.\n\n## Limitations\n\n- Not all systemd features are supported in the conversion process\n- Some complex systemd unit files may require manual adjustment after conversion\n- Socket activation is not supported\n- Timer units are not supported\n\n## Getting Help\n\n- Open an issue on GitHub with:\n  - The command you ran\n  - The complete error message\n  - Your Alpine Linux version\n  - The content of your systemd service file\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobydeck%2Fsystemctl-alpine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmobydeck%2Fsystemctl-alpine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobydeck%2Fsystemctl-alpine/lists"}