Solaris Boot Notes

 


Overview

All files in /etc/rc*.d/* are hardlinked from /etc/init.d (with better names), so you should grep in there.

There are many "run levels" to the System V init; the run level 3 is normally used for "multi user with networking."

When executing the scripts in an /etc/rc?.d directory, the K* scripts are executed first, followed by the S* scripts. Scripts ending in .sh are executed in the same shell and can be used to set environment variables used further on in the same directory.

A basic startup script looks like this:

    #!/bin/sh"
    # Sample /tech/sun/commands/init.d.html">init.d script.
    # Install a copy under /etc/init.d/your-daemon
    # make links to /etc/rc2.d/Sxxyour-daemon (or rc3.d)
    # and /etc/rc[01].d/Kxxyour-daemon.
    # Scripts ending in .sh are executed with the sh "." command.
    # Scripts not ending in .sh are executed as "sh script"

    case "$1" in
    start)
        #... commands to start daemon ....
        ;;
    stop)
        #... commands to stop daemon ....
        ;;
    esac

To have a real "local" rc file with just your changes in it, copy this file into /etc/init.d/rc.local, and ln it to /etc/rc3.d/S99rc.local. Put your startup stuff in the "start" section.

    #!/sbin/sh"
    # /etc/init.d/rc.local - to be linked into /etc/rc3.d as
    # S99rc.local -- a place to hang local startup stuff.
    # started after everything else when going multi-user.

    # Ian Darwin, Toronto, November, 1992
    # As with all system changes, use at own risk!

    case "$1" in
    'start')
        echo "Starting local services...\c"

        if [ -f /usr/sbin/mydaemon ]; then
            /usr/sbin/mydaemon
        fi
        echo ""
        ;;
    'stop')
        echo "$0: Not stopping any services."
        ;;
    *)
        echo "Usage: $0 { start | stop }"
        ;;
    esac

If you run a database (like Oracle) or INN, you should install a special /etc/rc0.d/K* script and make sure you always shutdown the long way.


 

Home