Tuesday 27 November 2012

Lesson 2 - System Resource Controller

System Resource Controller (SRC)

Objectives

Purpose of SRC
Parts of  SRC
Commands involved in SRC

 Purpose of SRC

  • A set of commands that make it very easy for the system administrators to maintain and manage the subsystems and subservers running on the system. 
  •  The subsystems and subservers are commonly called as “daemons”. 
  •  SRC allows us to stop, start, trace, list and refresh daemons. 
  •  SRC is started during the system initialization with a record for /usr/bin/srcmstr  daemon in the /etc/inittab file. 
  •  If the “srcmstr” daemon stops abnormally, the respawn action specified in /etc/inittab restarts the daemon .

 SRC hierarchy example

Fig: SRC Hierarchy


Components of SRC

There are 3 important components in the SRC

                   Subgroup  --> SubSystem --> SubServer

SubServer :
          A  subserver is a program or process that belongs to a subsystems, usually called daemons.
          Ex:  ftpd, telnetd are good examples of subservers.

SubSystem:
          A “subsystem” is a program or process ( a group of program or process) that perform related functions .  Subsystems can be further divided into subservers.
          Ex: inetd, gated, routed, named etc.,

Subsystem Group:
          A group of any specified subsystems. Grouping subsystems together allows the control of several subsystems at one time. 

        Ex: TCP/IP, NIS, NFS , spooler 

          #lssrc -g spooler     
        subsystem Group PID Status
          qdaemon    spooler 8022 active
          writesrv     spooler 9558 active
          lpd           spooler inoperative


        The following derives the relationship between subsystem/subservers  and subsystem group that are taken care by SRC

         #lssrc -a

General Commands

                1)  lssrc -t <subserver>
                2)  lssrc -s <subsystem>
                3)  lssrc -g <subsystem group>
                4) lssrc -p <PID>
                4) startsrc -g <ss group>
                5) stopsrc -g <ss group>
                6) startsrc -s <subsystem>
                7) stopsrc -s <subsystem>
                8) startsrc -t <subserver>
                9) stopsrc -t <subserver>
10) refresh <-g> <-s> <-t> <sg,ss,srvs>
11) mkssys  --> To add subsystem
12) rmssys -s < SS>  --> To remove the subsystem
13) chssys    --> Change the subsystem attributes

Create your own SRC subsystem

Using  “mkssys” command to register the  your new subsystem under the control of SRC

Common mkssys command options

Flag(s)
Description
-s
Name of the new subsystem
-p
Full path to executable program / shell script.
-u
Numeric uid for subsystem execution.   Must be a defined user.

Optional information:
-i, -o, -e
Standard input, output, error devices.     Default is /dev/console
-a
Arguments to the executable.
-G
Group name for related subsystems.
-K, -S, -I
Method of communications (Sockets [-K], Signals [-S], or Messages [-I]).     Default is Sockets.
-n, -f
The signal numbers used for normal (-n), or forced (-f), subsystem stop, if signals are used for communications.
-E
“Nice” value for subsystem execution priority.
-R, -O
Automatic restart (-R), or abort (-O) on abnormal termination. Whether to respawn or not.
-Q, -q
Single (-Q), or multiple (-q) instances allowed.
-w
Wait time between a normal and forced stop.


Example

#mkssys  -s example -p /usr/local/sample/script.sh -u $(uid -u user)  -S -n 15 -f 9 -R -Q

How to add inetd services?

i)   Add the appropriate port information to /etc/services file
ii) Add the appropriate configuration information to /etc/inetd.conf file
iii)   #refresh -s inetd

No comments:

Post a Comment