linux:Init Commands


syntax:

chkconfig –add ‘name’

Add a new service to be managed by chkconfig. As part of adding the service, chkconfig makes sure the service has a start or kill entry at every runlevel.

Examples:

chkconfig –add atd
starts the atd daemon

chkconfig –add ypserv
starts the ypserv daemon

syntax:

chkconfig –del name

Remove a service from chkconfig management. As part of the removal, symbolic links to the service are removed from /etc/rc0-6.d.

Examples:
chkconfig –del ldap
removes the ldap daemon

chkconfig –del irda
removes the irda daemon

chkconfig –level ‘level’ ‘name’

Specify the level to which a service should belong.

Examples:
chkconfig –level 5 lpd specifies level 5 for the lpd daemon

chkconfig –level 15 ntpd specifies levels 1 and 5 for the ntpd daemon.

chkconfig –level ‘level’ ‘name’ on|off|reset

Starts, stops, or resets the named service in the specified runlevel.

The on and off options affect levels 2, 3, 4, and 5.

Examples:
chkconfig –level 345 nfslock off

turns the nfslock daemon off in runlevels 3, 4, and 5

chkconfig ypxfrd on

turns the yp transfer daemon on in levels 2, 3, 4, 5

chkconfig –list

View a list of services and their runlevels.
If you use the name option, you’ll only get information for the named service.

init runlevel
telinit runlevel

Change the system runlevel.

Examples:

init 0 changes the system to runlevel 0, shutting the system down

init 1 changes the runlevel to 1, which is single-user mode, often used for maintenance tasks.

“runlevel” cmd

to View the current runlevel.

Init uses the /etc/inittab file to determine the system runlevel and load daemons.Below describes the format of the lines in the inittab file (the inittab uses a colon-delimited format).

1.label:

This field organizes the file to allow the init daemon to read it alphabetically.

2.runlevel(s):

This field specifies the runlevel(s) to which the line corresponds.

3.action:

This field tells init what action to take (e.g., respawn, wait, boot, bootwait, powerfail, powerwait).

4.command:

This field designates a shell command to execute.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s