Systemd Unit File Generator
Fill in service, timer or socket options with plain explanations, apply sandboxing, preview timer run times and copy the unit and commands.
ทำงานในเบราว์เซอร์ของคุณ ไฟล์ไม่ออกจากอุปกรณ์ ดูวิธีตรวจสอบ
…
วิธีทำ
- 1Choose a template
Pick a template or add a service, timer or socket with the + buttons.
- 2Name the unit
Type the unit name and choose system or user scope.
- 3Fill in options
Set ExecStart, User, Restart and other options; read the explanation under each one.
- 4Harden the service
Open the hardening section, press Apply recommended hardening and watch the exposure number.
- 5Schedule a timer
For a timer, set OnCalendar with a quick pick or your own expression and check the next run times.
- 6Install it
Open Unit file and install, fix any warnings, then copy the file and the install commands.
เกี่ยวกับเครื่องมือนี้
Running a program as a proper Linux service means writing a systemd unit, and the manual pages list hundreds of options. This generator focuses on the ones people actually need and explains each in one sentence: what Type=notify means, why After=network.target does not wait for the network, when Restart=on-failure is better than always. Services, timers and sockets are edited side by side, so a backup script and its nightly timer are built together. A hardening section applies sandboxing such as ProtectSystem=strict, PrivateTmp and a system call filter, and shows an exposure estimate that falls as you lock the service down. Timer schedules are previewed with their next five run times, and install, verify and log commands are written for you.
Who this is for
Developers deploying an app to a VPS without containers, administrators replacing cron jobs with timers, and anyone who wants a service that restarts after a crash and survives a reboot.
Templates
Start from a Node.js web app, a Python app under Gunicorn, a nightly backup with its timer, a Docker Compose stack, a socket-activated service or a user service that runs without root. Each template is a normal unit you can change.
Options with explanations
Options are grouped by section: [Unit] for description and ordering, [Service] for the process, user, environment and restart behaviour, [Timer], [Socket] and [Install]. Tick Show the explanation of every option to read them all; otherwise the explanation appears once an option is set. Unknown options from an imported file are kept and written back.
Hardening and exposure
The hardening section lists sandboxing options such as NoNewPrivileges, ProtectSystem, ProtectHome, PrivateDevices, ProtectKernelTunables, RestrictAddressFamilies, SystemCallFilter=@system-service and an empty CapabilityBoundingSet. Apply recommended hardening sets a strong baseline at once. The exposure number from 0 to 10 uses the labels of `systemd-analyze security` (SAFE, OK, MEDIUM, EXPOSED, UNSAFE) but is an estimate; run the real command on the server.
Timers
OnCalendar accepts the systemd.time syntax: shorthands like daily or weekly, weekday lists and ranges such as Mon..Fri, dates like *-*-01 and times with steps like *:0/15. The preview shows the normalised form and the next five times in your local time zone.
Worked example
A backup timer with OnCalendar=*-*-* 03:15:00, Persistent=true and RandomizedDelaySec=10min runs backup.service every night between 03:15 and 03:25, and if the server was off at that time it runs once at the next boot. The generated commands copy both files to /etc/systemd/system, run daemon-reload and `systemctl enable --now backup.timer`.
Limits
This tool writes unit files; it does not run them or check that the paths exist on your server. The exposure score is approximate and not identical to systemd-analyze. Calendar previews use your browser's time zone, which may differ from the server's. Some hardening options break particular programs, for example MemoryDenyWriteExecute with Node.js or Java, so test after enabling.
ตัวอย่างพร้อมวิธีทำ
OnCalendar=*-*-* 03:15:00 with RandomizedDelaySec=10min runs nightly between 03:15 and 03:25; Persistent=true catches up after downtime.
สรุปสั้น ๆ
- หมวดหมู่: นักพัฒนาและข้อมูล
- ทำงานในเบราว์เซอร์ ไม่ต้องสมัคร ไม่ต้องอัปโหลด
- ข้อมูลที่คุณกรอกอยู่บนอุปกรณ์ของคุณ
- มีภาษาอังกฤษ
- ตรวจสอบเนื้อหาล่าสุด:
- แหล่งข้อมูลทางการ: systemd manual pages: systemd.unit(5), systemd.service(5), systemd.exec(5), systemd.timer(5), systemd.socket(5), systemd.time(7)
คำถามที่พบบ่อย
What is the difference between Wants and After?
Wants starts another unit together with this one; After only orders them. To wait for a working network you need both, with network-online.target.
Which Type should I choose?
simple or exec for programs that stay in the foreground, notify for programs that signal readiness, forking for classic daemons that fork into the background, and oneshot for scripts that run and exit.
Is a timer better than cron?
Timers log to the journal, can catch up missed runs with Persistent=true, add random delays and depend on other units. Cron is simpler but less visible.
Will hardening break my service?
It can. ProtectSystem=strict makes the file system read-only, so add ReadWritePaths or StateDirectory for data the service writes. Test the service after applying hardening.
What is a user service?
A unit in ~/.config/systemd/user that runs as you without root, managed with systemctl --user. Enable lingering if it must keep running after you log out.
Is anything sent to a server?
No. Units are generated in the browser and saved only in local storage.
