Skip to main content Svelte Highlight v7.21.1

systemd language preview

1. A basic service unit

Unit, Service, and Install sections
horizon-dark
[Unit]
Description=Example web service
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
User=www-data
Environment=PORT=%p
ExecStartPre=-/usr/bin/mkdir -p /run/example
ExecStart=/usr/bin/example-server --port=${PORT}
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
atom-one-dark
[Unit]
Description=Example web service
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
User=www-data
Environment=PORT=%p
ExecStartPre=-/usr/bin/mkdir -p /run/example
ExecStart=/usr/bin/example-server --port=${PORT}
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
github-dark
[Unit]
Description=Example web service
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
User=www-data
Environment=PORT=%p
ExecStartPre=-/usr/bin/mkdir -p /run/example
ExecStart=/usr/bin/example-server --port=${PORT}
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
dracula
[Unit]
Description=Example web service
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
User=www-data
Environment=PORT=%p
ExecStartPre=-/usr/bin/mkdir -p /run/example
ExecStart=/usr/bin/example-server --port=${PORT}
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
nord
[Unit]
Description=Example web service
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
User=www-data
Environment=PORT=%p
ExecStartPre=-/usr/bin/mkdir -p /run/example
ExecStart=/usr/bin/example-server --port=${PORT}
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
github
[Unit]
Description=Example web service
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
User=www-data
Environment=PORT=%p
ExecStartPre=-/usr/bin/mkdir -p /run/example
ExecStart=/usr/bin/example-server --port=${PORT}
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

2. A timer unit

OnCalendar scheduling and Persistent
horizon-dark
[Unit]
Description=Run backup every day

[Timer]
OnCalendar=*-*-* 02:00:00
Persistent=true

[Install]
WantedBy=timers.target
atom-one-dark
[Unit]
Description=Run backup every day

[Timer]
OnCalendar=*-*-* 02:00:00
Persistent=true

[Install]
WantedBy=timers.target
github-dark
[Unit]
Description=Run backup every day

[Timer]
OnCalendar=*-*-* 02:00:00
Persistent=true

[Install]
WantedBy=timers.target
dracula
[Unit]
Description=Run backup every day

[Timer]
OnCalendar=*-*-* 02:00:00
Persistent=true

[Install]
WantedBy=timers.target
nord
[Unit]
Description=Run backup every day

[Timer]
OnCalendar=*-*-* 02:00:00
Persistent=true

[Install]
WantedBy=timers.target
github
[Unit]
Description=Run backup every day

[Timer]
OnCalendar=*-*-* 02:00:00
Persistent=true

[Install]
WantedBy=timers.target

3. Sandboxing options

hardening keys and literal on/off values
horizon-dark
[Service]
ExecStart=/usr/bin/example-daemon
PrivateTmp=true
ProtectSystem=strict
ProtectHome=read-only
NoNewPrivileges=true
DynamicUser=yes
StandardOutput=journal
StandardError=journal
atom-one-dark
[Service]
ExecStart=/usr/bin/example-daemon
PrivateTmp=true
ProtectSystem=strict
ProtectHome=read-only
NoNewPrivileges=true
DynamicUser=yes
StandardOutput=journal
StandardError=journal
github-dark
[Service]
ExecStart=/usr/bin/example-daemon
PrivateTmp=true
ProtectSystem=strict
ProtectHome=read-only
NoNewPrivileges=true
DynamicUser=yes
StandardOutput=journal
StandardError=journal
dracula
[Service]
ExecStart=/usr/bin/example-daemon
PrivateTmp=true
ProtectSystem=strict
ProtectHome=read-only
NoNewPrivileges=true
DynamicUser=yes
StandardOutput=journal
StandardError=journal
nord
[Service]
ExecStart=/usr/bin/example-daemon
PrivateTmp=true
ProtectSystem=strict
ProtectHome=read-only
NoNewPrivileges=true
DynamicUser=yes
StandardOutput=journal
StandardError=journal
github
[Service]
ExecStart=/usr/bin/example-daemon
PrivateTmp=true
ProtectSystem=strict
ProtectHome=read-only
NoNewPrivileges=true
DynamicUser=yes
StandardOutput=journal
StandardError=journal