feat: script and exec runtimes with configurable shell

Add runtime: script (shell file, default /bin/bash, optional stop_script) and runtime: exec (executable with args, optional stop_executable). Both support service_type simple|oneshot and working_dir.
This commit is contained in:
2026-10-12 19:45:54 +02:00
parent 173b4b2523
commit 95143dd998
5 changed files with 251 additions and 1 deletions
+35
View File
@@ -138,8 +138,43 @@ units:
compose_bin: /usr/bin/podman-compose
order: 3
enabled: true
- name: backup # shell script unit
runtime: script
script: /opt/scripts/backup.sh # required
stop_script: /opt/scripts/stop.sh # optional → ExecStop
shell: /bin/bash # optional, default /bin/bash
service_type: simple # simple (default) | oneshot
working_dir: /opt/scripts # optional
order: 4
enabled: true
- name: agent # executable unit
runtime: exec
executable: /opt/agent/bin/agent # required
args: [--config, /etc/agent.toml] # optional
stop_executable: /opt/agent/bin/stop # optional → ExecStop
order: 5
enabled: true
```
### Script / executable units
Added manually (`unitdore edit`); syncup never creates or disables them.
| Key | Runtime | Meaning |
|---|---|---|
| `script` | script | Required. `ExecStart=<shell> <script>` |
| `stop_script` | script | Optional. `ExecStop=-<shell> <stop_script>` |
| `shell` | script | Interpreter, default `/bin/bash` |
| `executable` | exec | Required. `ExecStart=<executable> <args>` |
| `args` | exec | Optional list, quoted as needed |
| `stop_executable` | exec | Optional. `ExecStop=-<stop_executable>` |
| `service_type` | both | `simple` (default) or `oneshot` (RemainAfterExit=yes) |
| `working_dir` | both | Optional `WorkingDirectory` |
| `command` | both | If set, overrides ExecStart |
| `user` | both | Set for a user unit |
### Stacks (podman-compose)
| Condition | Unit |