Startup – Make /etc/rc.local Run on Startup

scriptsstartup

I have a script I would like to run when my system starts and have put it in /etc/rc.local, but it doesn't work. How can I enable it to run on startup?

Best Answer

Can you run your script manually; if not, it's a problem with that script, otherwise look more at rc.local. If that script needs to run as root, sudo must be used to manually run it.

  • Ensure /etc/rc.local, and the script it call, is executable:
    ls -l /etc/rc.local
      -rwxr-xr-x 1 root root 419 2010-08-27 11:26 /etc/rc.local
    
  • Ensure rc.local has a shebang line, which is the default:
    head -n1 /etc/rc.local
      #!/bin/sh -e