Книга: Fedora™ Unleashed, 2008 edition
Controlling Apache with Fedora's chkconfig Command
Controlling Apache with Fedora's chkconfig
Command
The chkconfig
command provides a command-line-based interface to Fedora's service scripts. The command can be used to list and control which software services are started, restarted, and stopped for a specific system state (such as when booting up, restarting, or shutting down) and runlevel (such as single-user mode, networking with multitasking, or graphical login with X).
For example, to view your system's current settings, take a look at Fedora's default runlevel as defined in the system initialization table /etc/inittab
using the grep
command:
# grep id: /etc/inittab
id:3:initdefault:
This example shows that this Fedora system boots to a text-based login without running X11. You can then use the chkconfig
command to look at the behavior of Apache for that runlevel:
# chkconfig --list | grep httpd
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
Here you can see that Apache is turned off for runlevels 3 and 5 (the only two practical runlevels in a default Fedora system, although you could create a custom runlevel 4 for Apache). Use --level
, httpd
, and the control keyword on
to set Apache to automatically start when booting to runlevel 3:
# chkconfig --level 3 httpd on
You can then again use chkconfig
to verify this setting:
# chkconfig --list | grep httpd
httpd 0:off 1:off 2:off 3:on 4:off 5:off 6:off
To have Apache also start when your system is booted to a graphical login, again use level, httpd
, and the control keyword on
, but this time, specify runlevel 5 like so:
# chkconfig --level 5 httpd on
Again, to verify your system settings, use the following:
# chkconfig --list | grep httpd
httpd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
Use the off
keyword to stop Apache from starting at a particular runlevel.
- Starting and Stopping Apache
- Controlling Apache with Fedora's service Command
- 7. Macros: Standard Control Constructs
- Controlling Evaluation
- Appendix A. Detailed explanations of special commands
- Using Double Quotes to Resolve Variables in Strings with Embedded Spaces
- Drawbacks with restore
- Basics of the iptables command
- Commands
- 7. AGGREGATION WITH INDEPENDENT WORKS
- Creating CDs from the Command Line
- Загрузка модулей Apache