systemd Service and Timer Generator

From a command line to a hardened service.

Describe the program you want to run, and get a service unit with sensible restart, user, environment, and sandboxing settings, an optional timer, a cron to OnCalendar converter, and the exact commands that install and check it all.

Zero retention: your data never leaves this browser. Verify it yourself in DevTools

Loading the toolbox.

About systemd

How Can You Verify That Nothing Leaves This Browser?

You do not have to take our word that your data stays here. Developer tools show every request a page makes, so you can watch this page work and confirm that nothing is sent. The check takes under a minute.

  1. Open your browser developer tools with F12, or Cmd+Option+I on a Mac, and select the Network tab.
  2. Reload the page and let it finish. You will see the page's own files, its web fonts, and one anonymous page-view request. Nothing has been typed yet, so none of them can contain your data.
  3. Click the clear icon in the Network tab so that the log is empty.
  4. Use the tool with your own input.
  5. Look at the Network tab again. It is still empty. For extra proof, turn on offline mode after the page loads and the tool keeps working.

Only two things can add a line to that log, and neither carries your data. Submitting the feedback form sends the vote and comment you typed. Typing characters in a script the page has not displayed yet, such as Cyrillic or Greek, can make the browser fetch the matching font file, and that request names only the font.

The production site also sends a Content-Security-Policy header that tells your browser to refuse connections to anywhere except this site and the anonymous analytics endpoint, so a coding mistake could not quietly send your data elsewhere.

What Does the systemd Generator Make?

It writes the two plain-text files that systemd uses to run a program for you. A service unit (myapp.service) says what to run, as which user, with which environment, and what to do when the process stops. A timer unit (myapp.timer) says when to start that service, which makes it the systemd replacement for a crontab line.

Next to the files you get the commands that install them, for a system service under /etc/systemd/system/ or a user service under ~/.config/systemd/user/. Every directive the generator writes has a comment on the line above it that explains what it does, because unit files do not allow comments at the end of a line.

Which Service Options Can You Set?

  • Type: exec is the default because a missing binary then shows up as a failed start; simple, notify for programs that call sd_notify, oneshot for jobs, and forking for old daemons.
  • ExecStart: the command and its arguments. systemd does not run it through a shell, so the generator warns about pipes, redirects, and &&, and about a program name that is not an absolute path.
  • User and Group, or DynamicUser: without one of them a system service runs as root, and the page says so.
  • Environment: each KEY=value becomes a quoted Environment= line with quotes, backslashes, and percent signs escaped. Keys that look like passwords or tokens get a warning to move them into an EnvironmentFile, because systemctl show lets local users read Environment= values.
  • Restart: on-failure, on-abnormal, always, or no, with RestartSec and a start limit of five starts in five minutes so a broken service stops instead of looping forever.
  • Network: After= and Wants=network-online.target for services that need the network at start.

What Do the Hardening Levels Do?

systemd can sandbox a service with a few lines, and systemd-analyze security scores the result. The Basic level adds settings that almost every service tolerates: NoNewPrivileges=yes, a private /tmp, a read-only /usr, /boot, and /etc with ProtectSystem=full, and no access to home directories.

The Strict level makes the whole file system read-only except the paths you list in ReadWritePaths=, hides physical devices, locks kernel tunables, modules, and control groups, blocks setuid files, realtime scheduling, and new namespaces, drops every capability, and allows only native system calls. It also sets MemoryDenyWriteExecute=yes, which breaks just-in-time compilers. When ExecStart looks like Node.js, Java, .NET, PHP, Ruby, Deno, Bun, or PyPy, that line is written commented out, and the page tells you why. Start with Basic, check the service works, then move to Strict and test again.

How Does Cron Convert to OnCalendar?

Cron uses five fields: minute, hour, day of month, month, and day of week. OnCalendar uses a date and time pattern: DayOfWeek Year-Month-Day Hour:Minute:Second. The converter maps each field across. A list stays a list, a range such as 9-17 becomes 09..17, weekday numbers become names such as Mon..Fri, a step such as */15 becomes 00/15, and macros such as @daily and @weekly are expanded first. So */15 9-17 * * 1-5 becomes Mon..Fri *-*-* 09..17:00/15:00.

There is one trap that the converter handles for you. When a cron line sets both the day of month and the day of week, cron runs the job when either one matches. A single OnCalendar line requires both. To keep the cron meaning, the converter writes two OnCalendar lines, because a timer fires whenever any of its lines matches. Quartz-only syntax such as ?, L, W, and #, and six-field expressions with seconds, are refused with an explanation instead of being guessed at.

Why Use a systemd Timer Instead of Cron?

  • Logs: every run goes to the journal, so journalctl -u myapp.service shows the output and exit status of each one.
  • Missed runs: Persistent=true runs a job once at boot if the machine was off at the scheduled time.
  • Spread load: RandomizedDelaySec= adds a random delay up to the value you set, so many machines do not fire at the same second.
  • Same sandbox: the job runs as a normal service, with the user, environment, and hardening settings above.
  • Check the schedule: systemd-analyze calendar --iterations=5 prints the next five times a line will fire, before you rely on it.

Cron is still simpler for a one-line personal job. A timer is worth it when you want logs, catch-up runs, and the same controls as your other services.

How Do You Install the Units?

For a system service, copy the files to /etc/systemd/system/, check them with systemd-analyze verify, run systemctl daemon-reload so systemd reads them, and then systemctl enable --now the service, or the timer when there is one. systemctl status and journalctl -u show whether it started. For a user service, the same steps use ~/.config/systemd/user/ and systemctl --user, plus loginctl enable-linger so the service keeps running after you log out and starts at boot.

When you change a unit file later, run daemon-reload again and restart the service. The other command builders in this lane, such as the Dockerfile generator and the OpenSSL command builder, follow the same pattern: a command or file you can read before you run it.

What Other Tools Are in the Commands Lane?

  • tar: Paste a tar command to have every flag explained and the -C ordering trap flagged, or tick what you want and copy the command.
  • ffmpeg: Pick a task to get an explained ffmpeg command, decode a pasted one, or work out the bitrate for a target file size.
  • Git commands: Describe what you want to do in git, from undoing a commit to recovering a deleted branch, and get the command with a danger badge.
  • OpenSSL: Explained OpenSSL commands for keys and CSRs with SANs, self-signed certificates, inspection, PEM, PFX, and DER conversion, and chain checks.
  • Dockerfile: Generate a multi-stage Dockerfile for Node, Python, static sites, or Go with a non-root user and healthcheck, plus a .dockerignore and a paste linter.

Elsewhere in the toolbox: UUID, .gitignore, CSP, .htaccess, and more on the 2toolbox home page. Part of the 2suite.io privacy-first ecosystem.

Frequently Asked Questions

Does this page run or install anything?

No. It only writes text in your browser. You copy the unit files and commands and run them on your own server.

Why must ExecStart use an absolute path?

systemd does not use your shell PATH. It finds bare program names only in a fixed list of system directories, so a full path is the reliable choice.

Why did my timer job run at a different time than cron?

Check the time zone and the day rules. When cron sets both day of month and day of week, either can match, so the converter writes two OnCalendar lines to keep that meaning.

Why does my Node.js service crash with the Strict level?

MemoryDenyWriteExecute blocks the just-in-time compiler that Node.js, Java, and similar runtimes need. Remove that line for those services.

Where should secrets go?

In an EnvironmentFile owned by root with mode 0600, or in LoadCredential. Environment lines inside the unit can be read by local users.

Was this helpful?