Skip to content
shellhacks.dev

systemd Service Generator

Generate a systemd unit for a Laravel queue worker, a Node.js app or a Go binary, with restart policy, environment, a dedicated user and sandboxing.

Free · No sign-up · Your inputs stay in your browser

Input

Generate a systemd service unit

Output

/etc/systemd/system/laravel-worker.service

745 characters

Install with: sudo systemctl daemon-reload && sudo systemctl enable --now laravel-worker. Follow logs with journalctl -u laravel-worker -f. systemd-analyze security laravel-worker scores the sandboxing. A queue worker should be restarted on deploy (php artisan queue:restart) so it loads the new code.

Runs in this browser. Nothing you paste is sent to a server.

Why systemd rather than a process manager

systemd is already on the server, restarts crashed processes, starts them at boot, collects their output in the journal and can sandbox them without containers. Restart=always with RestartSec=5 keeps a worker up; the StartLimit settings stop a crash loop from spinning forever.

Sandboxing

ProtectSystem=strict makes the whole file system read-only for the service except the paths in ReadWritePaths, so a compromised process cannot rewrite your code. systemd-analyze security name.service scores the unit. Each directive is explained in systemd.exec(5).

Share

Frequently asked questions

Where do I put the unit file?
/etc/systemd/system/name.service, then run systemctl daemon-reload and systemctl enable --now name.
How do I see my service's logs?
journalctl -u name -f follows them; add --since "10 min ago" to narrow down.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Go deeper

Suggested reading

Keep planning

Similar tools