systemd Services: Turn a Script into a Reliable Boot Service
rc.local causes three production problems: it starts too early, it doesn’t restart on crash, and it logs nothing. systemd fixes all three.
Script vs service
- Write the unit: /etc/systemd/system/myapp.service with ExecStart, Restart=always, RestartSec=5 and a non-root User;
- Ordering: After=network-online.target plus Wants=network-online.target so you don’t start before the network is up;
- Logs: journalctl -u myapp -f streams stdout; no need to roll your own log files for persistence.
Add MemoryMax and CPUQuota to keep one runaway process from taking the whole device down — worth having by default in production images.
Related products: RP01A dev board, IPA-RK3588 industrial board. Datasheets, firmware and SDKs are free at the Hugsun Documentation Center; for selection advice or volume pricing, talk to us.


