Run a command at boot with Gentoo


Normally in Gentoo you would want to create an init script via rc-update to start a service at boot. However if there are a few miscellaneous commands you would like to run you can add them to local.start.

The local.start init script is similar to rc.local in other distributions. It is the last init script to be run after all other services have been started at the end of the boot process.

Add your commands to local.start file located here.

You can also make commands run when the system is shutdown. These commands should be placed in local.stop located here.

  • Pingback: Vmware Server2 shutdown guest when shutdown/reboot host on gentoo | Takahisa's Weblog()

  • linux

    thanks this helped

  • pranav

    Thanks a lot , I was struggling with wicd and all :)

  • WorBlux

    The openRC /baselayout2 updgrade changed this.

    From /etc/init.d/local

    einfo “Starting local”

    local file
    for file in /etc/local.d/*.start ; do
    [ -x “$file” ] && “$file”

    if type local_start >/dev/null 2>&1; then
    ewarn “/etc/conf.d/local should be removed.”
    ewarn “Please move the code from the local_start function”
    ewarn “to scripts with an .start extension”
    ewarn “in /etc/local.d”

    return 0

    meaning that /etc/local.d/ is the proper place to put scripts ending with .start that you want executed when the local level starts.

  • Gabriel Dibble

    Thank you WorBlux :)

    After searching Google for a bit resulting in 08-dated responses, yours was what I was looking for.

    (My /etc/conf.d/local did not have anything to load at start or stop so once I removed the file the warning messages went away. I also noted and read the /etc/local.d/README which explains that new .start and .stop scripts are processed in lexical order.)

    Your response here is appreciated!