A hands-on guide to make scripts run at boot, even on systemd systems. 16.11.2025 | reading time: 3 min When a sysadmin needs a simple way to execute commands at boot, rc.local remains a practical tool that works on many distributions; this guide shows how to create, enable and test rc.local so he can run scripts at startup with confidence. Hands-on example Create a minimal rc.local, make it executable, add a systemd compatibility unit if needed, and enable it as follows so you see exactly what happens: ``` cat > /etc/rc.local <<'EOF' #!/bin/sh -e mkdir -p /var/run/myapp echo rc.local ran at $(date) >> /var/log/rc-local.log exit 0 EOF chmod +x /etc/rc.local cat > /etc/systemd/system/rc-local.service <<'EOF' [Unit] Description=/etc/rc.local Compatibility ConditionPathExists=/etc/rc.local [Service] Type=forking ExecStart=/etc/rc.local TimeoutSec=0 RemainAfterExit=yes [Install] WantedBy=multi-user.target EOF systemctl daemon-reload systemctl enable --now rc-local.service systemctl status rc-local.service --no-pager # Sample expected output line: Active: active (exited) since ... ``` Common pitfalls to avoid Remember the shebang and exit 0, set executable permissions, and mind that systemd will ignore rc.local unless a compatibility service exists; also avoid long-running or respawned daemons inside rc.local because systemd units are a better fit for managed services. Practical use cases Use rc.local for quick one-off tasks at boot, small environment tweaks, mounting helper filesystems, or launching legacy scripts that are not full services; when the task needs supervision, logging or restart policies, convert it into a proper systemd unit so he gets robust lifecycle control. Where rc.local fits rc.local is an adapter between old init-style workflows and modern systemd boots: it is handy for quick bootscripts and debugging, but for production services prefer systemd units, and for scheduling use cron with @reboot; keep security and ordering in mind when running commands as root. Final thought Getting rc.local to run reliably teaches important lessons about boot order, permissions and the transition from SysV to systemd; explore the differences, practise with examples, and consider formal study to deepen skills and certify with exams like CompTIA Linux+ or LPIC-1 using intensive preparation at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. boot-process scripting utilities