Skip to content
ToolMug

systemd Service File Generator

Keep a Node.js, Python or Go program running on a Linux server, start it at boot and restart it when it crashes — without remembering every systemd option. Fill in the command and user, choose a restart policy and environment variables, and copy the .service file together with the commands to install and start it. Tick Run on a schedule to get a .timer as a modern alternative to cron.

Runs in your browser — nothing you enter is uploaded

Becomes the file name, e.g. myapp → myapp.service

Use the full path to the program, e.g. /usr/bin/python3 app.py

The command keeps running in the foreground (most web apps and scripts).

One KEY=value per line; values with spaces are quoted for you.

0 keeps the system default.

myapp.service

Install and start

Paste the commands on the server as root. After editing a unit file, run systemctl daemon-reload again. Logs: journalctl -u <name>.

How to use

  1. Enter the service name, the command with its full path and the working directory.
  2. Set the user, restart policy and any environment variables.
  3. Optionally add basic hardening or a schedule (OnCalendar) to create a timer.
  4. Copy the generated files, or paste the install commands into a root shell on the server.

Options explained

Type
simple suits programs that stay in the foreground; oneshot suits scripts that run once, such as scheduled jobs.
Restart
On failure restarts the service when it exits with an error or crashes; Always also restarts it after a normal exit.
OnCalendar
When the timer fires, e.g. daily or *-*-* 03:00:00 for 3 a.m. every day. Test expressions with systemd-analyze calendar.

Example: a nightly job as a timer

To run a script every night at 3 a.m., set the Command (ExecStart) to /usr/local/bin/backup.sh, the service name to backup, Type to oneshot and Restart to Never, then tick “Run on a schedule (create a .timer)” and “Basic hardening”. With the default user and working directory, the generator produces two files. backup.service:

[Unit]
Description=Nightly backup

[Service]
Type=oneshot
User=www-data
WorkingDirectory=/srv/myapp
ExecStart=/usr/local/bin/backup.sh
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=full
ProtectHome=read-only

and backup.timer:

[Unit]
Description=Run backup on a schedule

[Timer]
OnCalendar=*-*-* 03:00:00
Persistent=true
Unit=backup.service

[Install]
WantedBy=timers.target

Two things change when a timer is on. The service file loses its [Install] section, because the timer starts it instead, and the install commands enable the timer rather than the service:

sudo systemctl daemon-reload
sudo systemctl enable --now backup.timer
systemctl list-timers backup.timer
journalctl -u backup.service -f

The Type is not changed for you when you tick the timer option, so choose oneshot yourself for jobs that finish. A oneshot service combined with Restart Always is not valid, so the generator leaves Restart out and shows a warning.

Frequently asked questions

Where do I put the file?

In /etc/systemd/system/. Then run systemctl daemon-reload and systemctl enable --now <name>.service — the generated commands do all of this.

Why does my service fail with “Executable path is not absolute”?

Older systemd versions need the full path to the program in ExecStart. Find it with which, e.g. which node.

Timer or cron?

Timers log to the journal, can catch up on runs missed while the server was off, and never run twice at once. cron is simpler for one-liners and still works fine.

Privacy

This tool runs entirely in your browser. Your files and text are processed on your device and are never uploaded to our servers.

Related tools