Skip to content

rc-local.service

On ubuntu, I noticed that this service is failed. Refer the following links to understand the issue and resolve.

Reference 1 | Reference 2 | Reference 3 |

Following is my understanding:

  1. rc means Run Control.
  2. The file rc.local does not contain information on system startup components, but only superuser/root defined components.
  3. Not all root startup programs are described in rc.local but only those which don’t interfere with system components
  4. the file rc.local is executed after normal services are started.
  5. The failure mostly related to not ending the script with exit 0 or your default script is not /bin/sh. Adding #!/bin/sh -e at the begining of the script and exit 0 at the end of the script. sometime the script is not executable and not owned by root.
    #!/bin/sh -e
    COMMANDS
    exit 0
    
  6. We may add service to enable it via servicectl.
  7. you can create the file, if it doesnt' exists (as given in Reference 3).
  8. This is one of the mechanism available. crontab can also be used for the same purpose

My view: I prefer to use this to run start up scripts for the applications I host in the server. But for the services, setting up via systemctr seems more convenient to maintain.