DevTools Logo

Systemd Service & Timer Builder

Systemd Service & Timer Builder

Build valid systemd unit files locally with service hardening and timer schedules.

Unit settings

Generate deterministic systemd service and timer unit files locally. Validate common OnCalendar expressions and catch incompatible oneshot restart settings before deployment.

Examples

Deterministic service with sorted environment

Input
buildSystemdUnits({ type: "exec", restart: "on-failure", environment: { ZED: "2", APP_ENV: "prod" }, execStart: "/srv/app/bin/server" })
Output
Environment=APP_ENV=prod\nEnvironment=ZED=2 plus Type=exec and Restart=on-failure

Environment entries sort by key with localeCompare, so any insertion order renders the identical unit.

Oneshot restart conflict

Input
buildSystemdUnits({ type: "oneshot", restart: "always", execStart: "/usr/bin/backup" })
Output
warnings: ["Type=oneshot ile Restart=always birlikte kullanılamaz; ..."]

oneshot units cannot restart always; the builder keeps the values but flags the conflict in warnings.

About this tool

Systemd Service Builder emits unit files with buildSystemdUnits(config) (aliased as generateSystemdUnits): a [Unit] section with Description and After, a [Service] section with Type (default simple), Restart (default on-failure), User, WorkingDirectory, ExecStartPre/ExecStart/ExecStartPost, alphabetically sorted Environment=KEY=value lines, hardening flags (NoNewPrivileges, ProtectSystem, PrivateTmp), and an [Install] section defaulting to WantedBy=multi-user.target. Newlines inside values are flattened to spaces.

Timer support is built in: passing timer produces a companion unit with its own Description, OnCalendar, OnBootSec, RandomizedDelaySec, and Persistent fields plus WantedBy=timers.target. OnCalendar strings validate through validateCalendarEvent, which accepts *-*-* *:*:* style expressions, weekday ranges like Mon..Fri 09:30, and HH:MM[:SS] times with 00:00:00–23:59:59 range checks — invalid values still emit but add their message to warnings.

The builder warns rather than throws on the classic conflict: Type=oneshot with Restart=always yields "Type=oneshot ile Restart=always birlikte kullanılamaz; Restart=on-failure veya no seçin." Environment ordering is fully deterministic — the same keys in any insertion order produce byte-identical service text.

How to use this tool

  1. Describe the service

    Provide execStart plus optional description, type, restart, user, workingDirectory, and environment; unset fields fall back to simple/on-failure/multi-user.target defaults.

  2. Harden the unit

    Set noNewPrivileges, protectSystem (no/full/strict), and privateTmp to emit their NoNewPrivileges/ProtectSystem/PrivateTmp lines.

  3. Add a timer if needed

    Pass timer with onCalendar (e.g. *-*-* *:*:*), onBootSec, randomizedDelaySec, or persistent; check validateCalendarEvent or warnings for schedule errors.

  4. Heed the warnings

    A Type=oneshot plus Restart=always combination or an invalid OnCalendar surfaces in warnings — switch to Restart=on-failure or no, or fix the calendar expression.

Use cases

Shipping app services

Generate [Unit]/[Service]/[Install] blocks with user, working directory, environment, and ExecStart for daemons.

Scheduling with timers

Pair the service with a timer unit using OnCalendar expressions validated against systemd.time rules.

Applying sandbox hardening

Emit NoNewPrivileges, ProtectSystem=strict, and PrivateTmp to lock down services with private /tmp and read-only system paths.

Common mistakes

Mistake:Pairing Type=oneshot with Restart=always.

Fix:oneshot units exit by design — use Restart=on-failure or no instead, as the warnings message instructs.

Mistake:Writing free-form OnCalendar strings like "tomorrow-ish".

Fix:Use *-*-* *:*:* or weekday HH:MM[:SS] forms; validateCalendarEvent rejects anything else with a Geçersiz OnCalendar message.

Mistake:Relying on environment insertion order.

Fix:Keys always sort alphabetically, so diff-based reviews stay stable — do not encode meaning in the order you typed them.

Frequently asked questions

What does this tool do?

It generates a systemd service unit ([Unit], [Service], [Install] sections with sorted Environment= lines and hardening flags) and, when you supply a timer, a companion timer unit — with warnings for conflicts like Type=oneshot with Restart=always and for invalid OnCalendar expressions.

Why does Type=oneshot with Restart=always produce a warning?

oneshot units are expected to exit after running, so always restarting them is a configuration error. The builder keeps your values but warns in Turkish to pick Restart=on-failure or no instead.

Is my unit configuration uploaded or stored?

No. Unit text is assembled from your inputs with local string templating — nothing leaves your device.

Which OnCalendar formats are accepted?

Systemd calendar forms such as *-*-* *:*:* and weekday ranges like Mon..Fri 09:30, with HH:MM[:SS] times range-checked to 00:00:00–23:59:59. Free-form strings like tomorrow-ish fail validation and surface their message in warnings while the timer still emits.

References & standards

.env Secret Safety Linter

Validate .env syntax and spot likely leaked credentials or placeholder secrets.

.htaccess Generator

Build an Apache .htaccess — HTTPS redirects, rewrites, error pages, security headers, and basic auth

2D Fluid Dynamics & Particle Physics Sandbox

A physics playground with two engines sharing one canvas. The fluid mode runs a real Eulerian Navier-Stokes solver — semi-Lagrangian advection, explicit diffusion, Jacobi pressure projection and vorticity confinement — that you paint with dye and velocity using mouse or touch. The particle mode is a damped Verlet N-body engine with gravity wells, Coulomb attractors and repulsors, spring links, wall restitution and elastic circle collisions. Particle counts adapt to the device (100k target on WebGL2 desktop, 2k-5k on CPU fallback), and every configuration exports as runnable code: a Matter.js world, a PixiJS ticker setup, or a standalone vanilla Canvas engine.

AI Function Calling Schema Generator

Generate function calling JSON schemas from TypeScript interfaces

Algorithm Arena & Data Structure Visualizer

Interactive arena for algorithms and data structures: eight sorting algorithms racing on one seeded input, six pathfinding algorithms walking generated mazes, and BST, AVL, Red-Black, B-tree, heap and trie operations replayed step by step with rotations highlighted. Every run shows the Big-O table and the phase-highlighted reference implementation in four languages, and compared values can be played as pitch (sonification) through the shared audio engine. Everything runs client-side; inputs never leave the browser.

Ansible Playbook Generator

Build an Ansible playbook — hosts, vars, and tasks with modules — as YAML