Fedora service startup management

Source: Internet
Author: User

The Apache SVN server configured yesterday cannot be opened this morning. I checked the server and opened it. Therefore, log on to the system and use service httpd stop. failed!
The service is not automatically started. Service httpd start, started successfully, and SVN can be accessed normally. The problem is that it is impossible to do this on a daily basis, so
Google finally figured out service control at different running levels.
In fact, it is very simple: chkconfig -- list to view the service situation, where httpd's
Httpd 0: off 1: off 2: off 3: off 4: off 5: on 6: Off
It can be seen that the service is automatically opened only under the runtime level 5, that is, the graphic interface. The current running level
[Root @ localhost ~] #/Sbin/runlevel
N 3
Therefore, you can change the running Level 3 to on:
Chkconfig -- level 3 httpd on
Check: chkconfig -- list
Httpd 0: off 1: off 2: off 3: On 4: off 5: on 6: Off
Success!

Repost one article:

Fedora Service Management

Address: http://www.mjmwired.net/resources/mjm-fedora-manage-services.html
Author: Mauriat Miranda
Zhang yichi, zyichi@gmail.com

Introduction

This Guide describes how to manage services in the Fedora Core Linux system ). The content includes: What is service, what is runlevels, how to set services, and how to manage services ).

Service)

Services (often called background processes) are special programs run in the background. They are often non-interactive (no console ). It can be used for various purposes: Hardware Management, network connection, monitoring, logs, and so on. Almost all operating systems run some automated tasks through services.

Runlevel)

Runlevel is a collection of background running programs. systems running at different levels start different services (also called background processes ). The running levels of Fedora/RedHat Linux systems are as follows:

  • Runlevel 1: single-user mode

  • Runlevel 2: Multi-User Mode

  • Runlevel 3: multi-user mode with network functions

  • Runlevel 5: Graphical User Mode (runlevel 3 + X Window System "graphical user interface ").

Most users' systems run at level 5 of X-server, and many servers run at level 3 of X-server. Generally, runlevel 1 does not start any service.

You can view the system running level by running the following command:

#/Sbin/runlevel

Run the following command to view the running level of your system at the next startup:

# Cat/etc/inittab | grep: initdefault:
ID: 5: initdefault:

You can change the system running level by modifying the value of initdefault in line 3 of the/etc/inittab file. The system will run at the specified running level at the next startup.

Run the following command to change the running level (replace runlevel with numbers such as 3 and 5 ):

#/Sbin/init runlevel

Note:When you switch from runlevel 5 to another runlevel, you will disable X-server and the entire graphic interface at the same time. Always make sure that you are running on a text terminal (CTRL-ALT-F1, F2, F3, F4) when switching the run level ).

By editing the grub Startup menu item, you can specify the running level at system startup. Specify the method: when the system starts, select the kernel you want to start, press the e key, and then add the desired running level at the end of the line, such as 1, 3, and 5. Then press enter and then press B to start the system.

Enable and disable services)

For all running levels, each service must be set to on or off.

Run the following command to view the services enabled at each running level:

#/Sbin/chkconfig -- list

You can enable or disable services for different running levels by running system-config-services on the command line. This command can only work in the GUI. (In earlier versions of fedora, The serviceconf command may be used to implement the system-config-services function)

The chkconfig command can enable the specified service. The following command enables the crond service at runlevel 3 and 5.

#/Sbin/chkconfig -- level 35 crond on

-- Level should be 1, 2, 3, 4, 5, or any combination of them. On (Enabled) can also be off (disabled ). Run man chkconfig for detailed help.

Management Services)

Whether the service is enabled or disabled at the current running level, it can be run and stopped.

View running services:

#/Sbin/service -- Status-all

Use Service to control services. For example:

#/Sbin/service crond status
Crond (PID 1604) is running...

The status parameter can be replaced with start, stop, status, reload, restart, and so on. For example:

[Root @ localhost yichi] # service crond
Usage:/etc/init. d/crond {START | stop | status | reload | restart | condrestart}
[Root @ localhost yichi] # service crond stop
Stopping crond: [OK]
[Root @ localhost yichi] # service crond start
Starting crond: [OK]
[Root @ localhost yichi] # service crond restart
Stopping crond: [OK]
Starting crond: [OK]

Commands in the/etc/init. d/directory can be controlled in this way. Similar methods for other control services:

#/Etc/init. d/crond status

In fact, all the functions mentioned above can be completed in the GUI by using the system-config-Services Command. However, sometimes you may not be able to use the GUI, for example, when logging on to another system through SSH. At this time, these commands become very useful.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.