Apache httpd boot shutdown, and set boot up

Source: Internet
Author: User
Originally from: http://blog.csdn.net/sunshineboyleng/article/details/5451751
Apache service, or httpd service, how to boot, how to boot. 2010-04-02 09:59

Operating system environment: Red Hat 5, specific as follows:
# uname-a
Linux machine1 2.6.18-164.el5xen #1 SMP Tue Aug 15:59:52 EDT 2009 x86_64 x86_64 x86_64
# Cat/etc/redhat-release
Red Hat Enterprise Linux Server Release 5.4 (Tikanga)

Apache, or httpd, version:
#/usr/sbin/httpd-v
Server version:apache/2.2.3
Server Built:jul 15 2009 09:02:25
Or
#/usr/sbin/apachectl-v
Server version:apache/2.2.3
Server Built:jul 15 2009 09:02:25

have been talking about Apache, or httpd;
In fact, httpd is a service, Apache is a trademark;
Just as pure water is a product, and Wahaha is a brand;
But because Apache is so famous, it seems that Apache is talking about httpd service.
Therefore, the latter text only says httpd service.


/usr/sbin/apachectl is actually a script;
/USR/SBIN/HTTPD is the real procedure;

The following answers how to start the httpd service.
Script Startup:
#/usr/sbin/apachectl Start
[Root@radius guoq]# Ps-ef|grep Apache
Apache 6680 6679 0 09:49? 00:00:00/usr/sbin/httpd-k start
Apache 6681 6679 0 09:49? 00:00:00/usr/sbin/httpd-k start
Apache 6682 6679 0 09:49? 00:00:00/usr/sbin/httpd-k start
Apache 6683 6679 0 09:49? 00:00:00/usr/sbin/httpd-k start
Apache 6684 6679 0 09:49? 00:00:00/usr/sbin/httpd-k start
Apache 6685 6679 0 09:49? 00:00:00/usr/sbin/httpd-k start
Apache 6686 6679 0 09:49? 00:00:00/usr/sbin/httpd-k start
Apache 6687 6679 0 09:49? 00:00:00/usr/sbin/httpd-k start
Root 6689 5393 0 09:49 pts/1 00:00:00 grep Apache
Stop is #/usr/sbin/apachectl stop; you're right.

If you read the script/usr/sbin/apachectl, you'll find two little secrets:
1. The script accepts the parameter Start,stop,restart, also has the graceful,graceful-stop;
2. In fact, the script or the parameters passed to the/USR/SBIN/HTTPD;

Therefore, we can
#/usr/sbin/httpd-k start
Start service;
#/usr/sbin/httpd-k stop
Stop service;

The following answers how to boot up.
If you look at
# Find/-name "httpd"
/var/log/httpd
/usr/sbin/httpd
/usr/lib64/httpd
/etc/rc.d/init.d/httpd
/etc/logrotate.d/httpd
/etc/httpd
/etc/sysconfig/httpd
/home/guoq/osrc/tcl8.4.19/tests/httpd
/opt/soft/httpd-2.2.14/httpd
/opt/soft/httpd-2.2.14/.libs/httpd
/opt/apache2.2.14/bin/httpd

We'll find out that Apache is ready to start the boot script,
/etc/rc.d/init.d/httpd

You can check if it is in the boot list:
# chkconfig--list | grep httpd
httpd 0: Off 1: Off 2: Off 3: Off 4: off 5: off 6: Off

If you want, you can add it to the boot list:
#chkconfig--add httpd
Alternatively, remove from the boot list:
#chkconfig--del httpd

In my system, it is already in the boot list:
httpd 0: Off 1: Off 2: Off 3: Off 4: off 5: off 6: Off
It's just not allowed to boot automatically.

I want it to start automatically at the current level of operation, I'm learning Java, and PHP;
# chkconfig--level 5 httpd on
# chkconfig--list httpd
httpd 0: Off 1: Off 2: Off 3: Off 4: Off 5: Enable 6: Off

Wait, how do I know my level of operation.
# RunLevel
N 5

Complete the full text.

I do not know why the above method, in my Ubuntu can not run up, so I went to the internet to find a

Find the following method:

1 Add the program script to the/ETC/INIT.D directory
sudo cp/home/cnscn/my_servd/etc/init.d/

2) Add to Startup list
sudo update-rc.d my_servd defaults

3) will produce the following connections:
Adding system startup For/etc/init.d/my_servd ...
/ETC/RC0.D/K20MY_SERVD->. /init.d/my_servd
/ETC/RC1.D/K20MY_SERVD->. /init.d/my_servd
/ETC/RC6.D/K20MY_SERVD->. /init.d/my_servd
/ETC/RC2.D/S20MY_SERVD->. /init.d/my_servd
/ETC/RC3.D/S20MY_SERVD->. /init.d/my_servd
/ETC/RC4.D/S20MY_SERVD->. /init.d/my_servd
/ETC/RC5.D/S20MY_SERVD->. /init.d/my_servd

4 Specifies the startup, shutdown level (20 indicates a level) (note the following.)
sudo update-rc.d my_servd start 20 3 4 5Start at the 3,4,5 level
sudo update-rc.d my_servd start 20 0 1 2 6. Off at the 3,4,5 level

Or
sudo update-rc.d my_servd start 20 3 4 5. Stop 20 0 1 2 6.

5) Removal Services
sudo update-rc.d-f my_servd Remove

Try it, it seems to be OK.

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.