need further understanding of init.d

I needt o know how what init.d does and how it knows which dameons/applications to turn off and how to restart the applications after reboot. any OS - solaris/hp-ux

init.d contains a bunch of scripts. that can be use to start or stop a daemon or application while the server is up and running or during boot or when entering another runlevel. Services or daemon that can be started could include things like networking, nfs, sendmail, apache.

init.d script is link through a symbolly link to rc script (run control script)

eg In the /etc/rc3.d directory shows

S60nfs -> ../init.d/nfs
lrwxrwxrwx 1 root root 15 13:11 S70nfsfs -> ../init.d/nfsfs

lrwxrwxrwx 1 root root 23 13:11 S80sendmail -> ../init.d/sendmail.init

when your system enter run level 3 or boot up in mult user mode
init.d start up applications or daemons in mult user mode.

when your system is shutdown init.d excute script in /etc/rc0.d which shutdown the application before your system goes down.
script in /etc/rc0.d start with K which indicate kill script

Note

S indicate a start up script in /etc/rc2.d or /etc/rc3.d while K indicate kill script in your /etc/rc0.d

so init.d shutdown down application and starts applications automatically.