Page 82 - DCAP602_NETWORK_OPERATING_SYSTEMS_I
P. 82

Network Operating Systems-I




                    notes          The rc program looks in the /etc/rc.d/rc3.d directory, executing any k* scripts (of which there
                                   are none in the rc3.d directory) with an option of stop. Then, all the s* scripts are started with
                                   an option of start. Scripts are started in numerical order—thus, the S10network script is started
                                   before the S85httpd script. This allows you to choose exactly when your script starts without
                                   having to edit files. The same is true of the k* scripts.
                                   Let’s look at what happens when we switch runlevels—say from runlevel 3 (full networking and
                                   multi-user mode) to runlevel 1 (single-user mode).
                                   First, all the k* scripts in the level to which the system is changing are executed. My Caldera
                                   Preview  II  (Red  Hat  2.0)  setup  has  seven  K  scripts  and  one  S  script  in  the  /etc/rc.d/rc.1/
                                   directory. The K scripts shut down nfs, sendmail, lpd, inet, cron, and syslog. The S script then
                                   kills off any remaining programs and executes init -t1 s, which tells the system to really go into
                                   single-user mode.
                                   Once in single-user mode, you can switch back to full multi-user mode by typing init 3.

                                   side-stepping init

                                   There are two additional points I can make here.
                                   First, you can selectively start and stop scripts, even those not native to your runlevel. Executing
                                   scripts in /etc/rc.d/init.d/ with an option of start or stop will start up or stop the programs or
                                   services which the script controls. This allows you to turn off NFS from runlevel 3 while keeping
                                   all other systems active, for example. Similarly, you can start NFS back up when you are ready.
                                       !
                                     Caution  Stopping NFS in this case would require stopping two systems—nfsfs and nfs.

                                     The nfsfs script will mount or ummount any of the NFS-mounted file-systems listed in
                                     your /etc/fstab. The nfs script would then shut down the processes associated with NFS,
                                     in this case mountd and nfsd.
                                     So the proper procedure for shutting down NFS would be:
                                     # /etc/rc.d/init.d/nfsfs stop
                                     Unmounting remote filesystems.
                                     # /etc/rc.d/init.d/nfs stop

                                     Shutting down NFS services: rpc.mountd rpc.nfsd
                                     #
                                     And starting NFS would be:

                                     # /etc/rc.d/init.d/nfs start
                                     Starting NFS services: rpc.mountd rpc.nfsd
                                     # /etc/rc.d/init.d/nfsfs start
                                     Mounting remote filesystems.
                                     #




                                      Task     “The  rc  program  looks  in  the  /etc/rc.d/rc3.d  directory,  executing  any  K*
                                     scripts.” Comment






          76                               LoveLy professionaL university
   77   78   79   80   81   82   83   84   85   86   87