Presentation is loading. Please wait.

Presentation is loading. Please wait.

70 Starting Network Services Version A.01 H3065S Module 7 Slides.

Similar presentations


Presentation on theme: "70 Starting Network Services Version A.01 H3065S Module 7 Slides."— Presentation transcript:

1 70 Starting Network Services Version A.01 H3065S Module 7 Slides

2 © 1999 Hewlett-Packard Co. H3065S A.01 71 Starting System and Network Services a67364 PDC chooses a boot disk. ISL finds and loads the kernel. Kernel calls /sbin/init. Init calls /sbin/rc. /sbin/rc starts system and network services. NFSDNSNTP Network Subsystem Kernel (vmunix) Network Drivers … Memory / /stand /etc /sbin /usr File System vmunix LANIC 1 2 3 init 4 /sbin/rc rc1.d rc2.d rc3.d Network daemons 1 2 3 4

3 © 1999 Hewlett-Packard Co. H3065S A.01 72 Run Levels a67365 init and /sbin/rc start and stop services in stages called run levels. The system run level determines what services are available. At boot, init progresses from run level 1 to 3, starting services. At shutdown, init progresses from run level 3 to 0, killing services. Example: (Not all run levels and services shown) Run LevelServices Available 3syncer, NFS, CDE 2syncer, NFS 1syncer 0 Startup Shutdown

4 © 1999 Hewlett-Packard Co. H3065S A.01 73 /sbin/rc*.d Directories a67366 /sbin/rc*.d directories determine at which run levels services start and stop. /sbin/rc runs S scripts to start services during system startup. /sbin/rc runs K scripts to kill services during system shutdown. K100dtlogin.rc K900nfs.server S340net S430nfs.client S500inetd S660xntpd /sbin rc2.d rc1.d rc0.d rc3.d

5 © 1999 Hewlett-Packard Co. H3065S A.01 74 S/K Script Naming Convention a67367 /sbin/rc2.d/S730cron Run Level Type Sequence Number Service Name

6 © 1999 Hewlett-Packard Co. H3065S A.01 75 /sbin/init.d/* Scripts a67368 /sbin init.d rc2.d rc1.d cron K270cron S730cron link Every service started by /sbin/rc has an associated script in /sbin/init.d. /sbin/init.d scripts contain code needed to actually start/kill services. /sbin/rc*.d/* scripts are just symbolic links to /sbin/init.d scripts!

7 © 1999 Hewlett-Packard Co. H3065S A.01 76 What’s in an init.d Script? a67369 case $1 in start_msg) echo “Start clock daemon” stop_msg) echo “Stop clock daemon” start) # Commands to start cron stop) # Commands to kill cron esac Scripts in /sbin/init.d accept a single argument. Scripts do one of four things, depending on the argument value. Sample init.d script (simplified): /sbin/init.d/cron:

8 © 1999 Hewlett-Packard Co. H3065S A.01 77 /etc/rc.config.d/* Files a67370 /etc/rc.config.d/cron CRON=1 # Set control variable to 1 to enable # Set control variable to 0 to disable /sbin/init.d/cron (simplified) case $1 in start_msg) echo “Start clock daemon” stop_msg) echo “Stop clock daemon” start) if CRON=1 then start the cron daemon stop) if CRON=1 then kill the cron daemon esac You may wish to disable a service that’s not needed, or enable a new service. Services may be enabled or disabled via control variables. Control variables are defined in files under /etc/rc.config.d. /sbin/init.d/ scripts source /etc/rc.config.d/* files to determine control variable values.

9 © 1999 Hewlett-Packard Co. H3065S A.01 78 Pulling it All Together a67371 Pool of Startup/Shutdown Scripts Data Configuration Files /etc/rc.config.d /sbin/init.d rc Script net inetd nfs.server nis.client...... netconf netdaemons nfsconf namesvrs...... /sbin/rc1.d /sbin/rc2.d /sbin/rc3.d K500inetd K660net K900nfs S340net S500inetd S100nfs.server start stop stop_msg start_msg

10 © 1999 Hewlett-Packard Co. H3065S A.01 79 Viewing Console Messages when Changing Run Levels a67372 init brings system to run level 2. init calls /sbin/rc. /sbin/rc executes /sbin/rc2.d/S* scripts with start_msg argument. /sbin/rc executes /sbin/rc2.d/S* scripts with start argument Transition to run level 2 complete. Start clock daemon..................[ ] Start internet services daemon......[ ] Start NFS client subsystem..........[ ] Start clock daemon..................[N/A] Start internet services daemon......[OK ] Start NFS client subsystem..........[OK ]

11 © 1999 Hewlett-Packard Co. H3065S A.01 80 Creating Custom Start Scripts a67373 Cookbook Procedure 1. cd /sbin/init.d 2. cp template scope_collect 3. vi scope_collect a. Edit start_msg statement b. Edit stop_msg statement c. Edit start statement i. Change CONTROL_VARIABLE to SCOPE_COLLECT ii. Add command /opt/perf/bin/scope.start iii. Add command set_return d. Edit stop statement i. Change CONTROL_VARIABLE to SCOPE_COLLECT ii. Add command /opt/perf/bin/scope.stop iii. Add command set_return 4. vi /etc/rc.config.d/scope_collect a. Add single line, SCOPE_COLLECT=1 5. ln -s /sbin/init.d/scope_collect /sbin/rc3.d/S900scope_collect 6. ln -s /sbin/init.d/scope_collect /sbin/rc2.d/K100scope_collect


Download ppt "70 Starting Network Services Version A.01 H3065S Module 7 Slides."

Similar presentations


Ads by Google