linux_systemd_unit_generator
Generate a complete systemd unit file by providing structured section fields for service, timer, socket, mount, path, or target types. Returns INI text and install commands without writing to disk.
Instructions
Systemd Unit Generator. Generate a complete systemd unit file from structured section fields and return the INI-style text ([Unit], the type body, [Install]) plus the install path and companion files. Set "operation" to "generate" (default) to build a unit, or "presets" to fetch ready-made example inputs. "unitType" selects the body section: service (ExecStart, Type, User, Restart, Environment, sandboxing), timer (OnCalendar/OnBootSec triggers, Persistent), socket (Listen* + Accept), mount (What/Where/Type/Options), path (Path* watches), or target. Per-section directives go in the matching object (unit, service, timer, socket, mount, path, install); every emitted directive is validated and missing ExecStart/triggers or weak hardening produce a warnings list (the unit is still returned). It only BUILDS the file text and copy-paste install commands — it never writes to disk, runs systemctl, enables, or starts any unit, and needs no privileges. Use this to author a .service/.timer/.socket file; use linux_ssh_con
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| operation | No | "generate" builds a unit from the fields below; "presets" ignores them and returns example inputs. | generate |
| unitType | No | Required for generate. Selects which body section is emitted and the file extension. Case-insensitive. | |
| filename | No | Output unit filename. Defaults to the slugified description plus the unitType extension (e.g. my-unit.service). | |
| description | No | Human-readable unit summary; emitted as Description= in [Unit]. | |
| unit | No | [Unit] directives keyed by directive name. Supports After, Before, Requires, Wants, Requisite, BindsTo, PartOf, Conflicts, OnFailure, Documentation, DefaultDependencies. | |
| service | No | [Service] directives (unitType=service). Common keys: Type, ExecStart (absolute path), Restart, RestartSec, User, Group, WorkingDirectory, Environment, plus sandboxing (PrivateTmp, ProtectSystem, ProtectHome, NoNewPrivileges) and limits. | |
| timer | No | [Timer] directives (unitType=timer). Keys: OnCalendar, OnBootSec, OnStartupSec, OnUnitActiveSec, OnUnitInactiveSec, OnActiveSec, AccuracySec, RandomizedDelaySec, Persistent, WakeSystem, RemainAfterElapse, Unit. | |
| socket | No | [Socket] directives (unitType=socket). Keys: ListenStream, ListenDatagram and other Listen* directives, Accept, SocketUser, SocketGroup, SocketMode, ReusePort, NoDelay, FileDescriptorName, MaxConnections. | |
| mount | No | [Mount] directives (unitType=mount). Keys: What (source, required), Where (absolute mount point, required), Type, Options, SloppyOptions, LazyUnmount, ForceUnmount, DirectoryMode, TimeoutSec. | |
| path | No | [Path] directives (unitType=path). Keys: PathExists, PathExistsGlob, PathChanged, PathModified, DirectoryNotEmpty, MakeDirectory, Unit (unit to activate on trigger). | |
| install | No | [Install] directives. Keys: WantedBy (e.g. multi-user.target), RequiredBy, Alias, Also, DefaultInstance. Omitting it warns the unit cannot be enabled. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | Always true on a 200 response. | |
| operation | No | Echoes the requested operation (generate or presets). | |
| result | No | For generate, the fields below. For presets, an object with a "presets" array of example requests. |