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:
@@ -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 |
|
||||
|
||||
Reference in New Issue
Block a user