Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

Linux reloading inittab without reboot
Page 1 of 1

Author:  debuser [ Thu Nov 26, 2009 4:49 am ]
Post subject:  Linux reloading inittab without reboot

Linux refresh init process after modifying inittab without reboot

man init
After it has spawned all of the processes specified, init waits for one of its descendant processes to die, a powerfail signal, or until it is signaled
by telinit to change the system's runlevel. When one of the above three conditions occurs, it re-examines the /etc/inittab file. New entries can be
added to this file at any time. However, init still waits for one of the above three conditions to occur. To provide for an instantaneous response,
the telinit Q or q command can wake up init to re-examine the /etc/inittab file.

If init is not in single user mode and receives a powerfail signal (SIGPWR), it reads the file /etc/powerstatus. It then starts a command based on the
contents of this file:

F(AIL) Power is failing, UPS is providing the power. Execute the powerwait and powerfail entries.

O(K) The power has been restored, execute the powerokwait entries.

L(OW) The power is failing and the UPS has a low battery. Execute the powerfailnow entries.

If /etc/powerstatus doesn't exist or contains anything else then the letters F, O or L, init will behave as if it has read the letter F.

Usage of SIGPWR and /etc/powerstatus is discouraged. Someone wanting to interact with init should use the /dev/initctl control channel - see the source
code of the sysvinit package for more documentation about this.

When init is requested to change the runlevel, it sends the warning signal SIGTERM to all processes that are undefined in the new runlevel. It then
waits 5 seconds before forcibly terminating these processes via the SIGKILL signal. Note that init assumes that all these processes (and their descenĂ¢
dants) remain in the same process group which init originally created for them. If any process changes its process group affiliation it will not
receive these signals. Such processes need to be terminated separately.

/sbin/telinit is linked to /sbin/init. It takes a one-character argument and signals init to perform the appropriate action. The following arguments
serve as directives to telinit:

0,1,2,3,4,5 or 6
tell init to switch to the specified run level.

a,b,c tell init to process only those /etc/inittab file entries having runlevel a,b or c.

Q or q tell init to re-examine the /etc/inittab file.

Following two commands will tell init to re-examine he /etc/inittab file:
# sudo init q

# sudo telinit q

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group