CentOS adds HTTP, MySQL, etc. to boot

Source: Internet
Author: User

CentOS adds HTTP, MySQL, etc. to bootoriginal October 14, 2016 22:48:36
    • Label:
    • CentOS/
    • Server
    • Mysql
    • 2377

Sometimes for a variety of reasons, need to restart the server, restart after the discovery site can not open, probably is the service did not open, organized the next service to join the boot command, as follows:
1. Check the boot entry:

chkconfig --list
    • 1

See here httpd and mysqld not set boot auto start

2. Set boot up:

on
    • 1

See the results again:

3. If the service you want to start is not found in the list, add it manually:

chkconfig --add sveserve
    • 1

4. Cancel Boot boot:

off
    • 1

There is also a way to directly modify the/etc/rc.d/rc.local file to add a command:

/etc/rc.d/init.d/mysqld start...
    • 1
    • 2

Set memcached to boot entry:

Create a new script file under/etc/rc.d/init.d/, name it memcached, and copy the following code in to save

#! /bin/bash## memcached Start/stop the memcached daemon## CHKCONFIG:35 80 70# description:memcached is a memory cache server.# prog="Memcached"Exec=/usr/local/memcached/bin/memcached lockfile=/var/lock/subsys/memcached# source function library. . /etc/rc.d/init.d/functionsStart () {if [$UID-ne0];ThenEcho"User has insufficient privilege."Exit4fi [x$exec] | |Exit5Echo-n $"Starting$prog: "Daemon$exec-U Root-d-p/var/run/memcached.pid retval=$?echo [$retval-eq0] && Touch$lockfile}Stop () {if [$UID-ne0];ThenEcho"User has insufficient privilege."Exit4FiEcho-n $"Stopping$prog: "if [-N"' Pidfileofproc$exec ' "];Then Killproc$execElse Failure $"Stopping$prog "Fi retval=$?echo [$retval-eq0] && RM-F$lockfile}Restart () {Stop Start}Rh_status () {# Run checks to determine if the service are running or use generic status status$prog}Rh_status_q () {rh_status >/dev/null2>&1}Case"$ " in " start ") rh_status_q && exit 0 $ ;; "Stop") rh_status_q | | Exit 0 $ ;; "restart") rh_status_q | | exit 7 $ ;; "status") rh_status;; *) echo $"Usage: $ Start|stop|status|restart}" exit 2;; Esac exit $?                 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21st
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81

Add to boot entry: #chkconfig --add memcached
To view the Startup items:#chkconfig --list memcached

CentOS adds HTTP, MySQL, etc. to boot

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.