CentOS adds HTTP, MySQL, etc. to bootoriginal October 14, 2016 22:48:36
- Label:
- CentOS/
- Server
- Mysql
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
See here httpd and mysqld not set boot auto start
2. Set boot up:
on
See the results again:
3. If the service you want to start is not found in the list, add it manually:
chkconfig --add sveserve
4. Cancel Boot boot:
off
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...
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