Override unit with drop-in systemd
Create /etc/systemd/system/myapp.service.d/override.conf with partial overrides
systemctl edit myapp.service
more systemd
all 26 commands →
Show unit file content
systemctl cat myapp.service
Analyze boot time
systemd-analyze blame | head -20
Draw boot dependency graph
systemd-analyze dot --require | dot -Tsvg > boot.svg && open boot.svg
Create a simple service unit
cat > /etc/systemd/system/myapp.service <<EOF
[Unit]
Description=My App
After=network.target
[Service]
ExecStart=/usr/bin/myapp
Restart=always
RestartSec=5
User=appuser
[Install]
WantedBy=multi-user.target
EOF
Run one-shot as another user
systemd-run --uid=1000 --gid=1000 --wait /usr/bin/myapp --task