I always forget how to do this, how to I change the inittab run level of a server/daemon?
feedback
|
|
There are a few different places. However, the following should cover most of the them: check in /etc/inittab use the "chkconfig" command to update the rcX.d directories with symbolic links to the /etc/init.d entries. | |||
|
feedback
|
|
To see the previous and current runlevel,
Here, there was no previous runlevel, and the current runlevel is 3. To change the runlevel temporarily,
To permanently change the default runlevel of the machine, change /etc/inittab's
Change 5 to your preferred level. If you're using RHEL or one of the clone distributions like CentOS, the default runlevel will be 3 for servers, and 5 for desktops where X should be started automatically. If you're using Debian or its various offshoots, the default runlevel will be 2. Ubuntu has moved to the upstart task selection program, so it may lack /etc/inittab and will use runlevel 2 by default. Create one if you want to change the default runlevel, or you can pass the runlevel as part of startup through grub. To change the runlevel of a daemon: If you're using RHEL or another RPM-based distro, chkconfig will probably be the most convenient way.
If you're using Debian, I usually manually change the status of a daemon per runlevel.
If the symlink for the daemon begins with K, it's stopped at that runlevel. If it starts with S, it is started at that runlevel. | ||||
|
feedback
|
|
You're really asking two questions.
1 is answered by Mark (His Answer) 2 is going to be system dependent. On RedHat based systems (RH, YDL, Fedora, etc) then you'll use chkconfig to configure everything. As an example, to have apache start at runlevels 3, 4, and 5, you would run:
On a gentoo system you would use the rc-update tool, and run these commands:
| |||
|
feedback
|
|
I really like sysv-rc-conf
If you have ubuntu : sudo apt-get install sysv-rc-conf | ||||
|
feedback
|
|
Daemons are usually started from scripts in /etc/rc.d/ or /etc/init.d There are symlinks to the corresponding startscript from a runlevel specific directory (e.g. /etc/rc0.d to /etc/rc6.d) In short: create a link from the respective directory in /etc/rc.d to the startscript of the daemon. The location of the link determins the runlevel. | ||||
|
feedback
|
|
For RHEL, look for the following line in /etc/inittab
The number in this line if the default run level. You can set it to the following options:
| ||||
|
feedback
|
|
For the server part, i normally use telinit | |||
|
feedback
|
