lnmp 单独查看状态,单独启动,单独停止。
进入/etc/init.d
$ ll /etc/init.d/
总用量 352
drwxr-xr-x 2 root root 4096 3月 28 09:44 ./
drwxr-xr-x 131 root root 12288 3月 28 12:01 ../
-rwxr-xr-x 1 root root 2243 2月 10 2016 acpid*
-rwxr-xr-x 1 root root 5336 4月 15 2016 alsa-utils*
-rwxr-xr-x 1 root root 2014 12月 29 2014 anacron*
-rwxr-xr-x 1 root root 6223 3月 4 2017 apparmor*
-rwxr-xr-x 1 root root 2805 3月 11 18:56 apport*
-rwxr-xr-x 1 root root 2401 11月 5 2015 avahi-daemon*
-rwxr-xr-x 1 root root 2968 3月 1 2016 bluetooth*
-rwxr-xr-x 1 root root 1275 1月 20 2016 bootmisc.sh*
-rwxr-xr-x 1 root root 2125 4月 27 2016 brltty*
-rwxr-xr-x 1 root root 3807 1月 20 2016 checkfs.sh*
-rwxr-xr-x 1 root root 1098 1月 20 2016 checkroot-bootclean.sh*
-rwxr-xr-x 1 root root 9353 1月 20 2016 checkroot.sh*
-rwxr-xr-x 1 root root 1343 4月 5 2016 console-setup*
-rwxr-xr-x 1 root root 3049 4月 6 2016 cron*
-rwxr-xr-x 1 root root 2816 2月 13 2016 cups*
-rwxr-xr-x 1 root root 1961 2月 13 2016 cups-browsed*
-rwxr-xr-x 1 root root 2813 12月 2 2015 dbus*
-rw-r--r-- 1 root root 1133 3月 28 09:44 .depend.boot
-rw-r--r-- 1 root root 1698 3月 28 09:44 .depend.start
-rw-r--r-- 1 root root 1713 3月 28 09:44 .depend.stop
-rwxr-xr-x 1 root root 1172 10月 24 2015 dns-clean*
-rwxr-xr-x 1 root root 1105 1月 25 2018 grub-common*
-rwxr-xr-x 1 root root 1336 1月 20 2016 halt*
-rwxr-xr-x 1 root root 1423 1月 20 2016 hostname.sh*
-rwxr-xr-x 1 root root 3809 3月 12 2016 hwclock.sh*
-rwxr-xr-x 1 root root 2372 4月 12 2016 irqbalance*
-rwxr-xr-x 1 root root 3102 3月 10 2016 kerneloops*
-rwxr-xr-x 1 root root 1804 4月 5 2016 keyboard-setup*
-rwxr-xr-x 1 root root 1300 1月 20 2016 killprocs*
-rwxr-xr-x 1 root root 2087 12月 21 2015 kmod*
-rwxr-xr-x 1 root root 3431 4月 1 2017 lightdm*
-rwxr-xr-x 1 root root 703 1月 20 2016 mountall-bootclean.sh*
-rwxr-xr-x 1 root root 2301 1月 20 2016 mountall.sh*
-rwxr-xr-x 1 root root 1461 1月 20 2016 mountdevsubfs.sh*
-rwxr-xr-x 1 root root 1564 1月 20 2016 mountkernfs.sh*
-rwxr-xr-x 1 root root 711 1月 20 2016 mountnfs-bootclean.sh*
-rwxr-xr-x 1 root root 2456 1月 20 2016 mountnfs.sh*
-rwxr-xr-x 1 root root 10565 3月 28 09:12 mysql*
-rwxr-xr-x 1 root root 1364 1月 3 2016 netfilter-persistent*
-rwxr-xr-x 1 root root 4771 7月 20 2015 networking*
-rwxr-xr-x 1 root root 1757 1月 12 2017 network-manager*
-rwxr-xr-x 1 root root 2801 3月 28 09:17 nginx*
-rwxr-xr-x 1 root root 1581 10月 16 2015 ondemand*
-rwxr-xr-x 1 root root 2354 3月 28 09:16 php-fpm*
-rwxr-xr-x 1 root root 1366 11月 15 2015 plymouth*
-rwxr-xr-x 1 root root 752 11月 15 2015 plymouth-log*
-rwxr-xr-x 1 root root 612 1月 28 2016 pppd-dns*
-rwxr-xr-x 1 root root 1192 9月 6 2015 procps*
-rwxr-xr-x 1 root root 6366 1月 20 2016 rc*
-rwxr-xr-x 1 root root 820 1月 20 2016 rc.local*
-rwxr-xr-x 1 root root 117 1月 20 2016 rcS*
-rw-r--r-- 1 root root 2427 1月 20 2016 README
-rwxr-xr-x 1 root root 661 1月 20 2016 reboot*
-rwxr-xr-x 1 root root 1964 3月 28 09:44 redis*
-rwxr-xr-x 1 root root 4149 11月 24 2015 resolvconf*
-rwxr-xr-x 1 root root 4355 7月 10 2014 rsync*
-rwxr-xr-x 1 root root 2796 2月 3 2016 rsyslog*
-rwxr-xr-x 1 root root 2522 7月 10 2015 saned*
-rwxr-xr-x 1 root root 3927 1月 20 2016 sendsigs*
-rwxr-xr-x 1 root root 597 1月 20 2016 single*
-rw-r--r-- 1 root root 1087 1月 20 2016 skeleton
-rwxr-xr-x 1 root root 2117 2月 19 2016 speech-dispatcher*
-rwxr-xr-x 1 root root 1154 1月 29 2016 thermald*
-rwxr-xr-x 1 root root 6087 4月 12 2016 udev*
-rwxr-xr-x 1 root root 2049 8月 7 2014 ufw*
-rwxr-xr-x 1 root root 2737 1月 20 2016 umountfs*
-rwxr-xr-x 1 root root 2202 1月 20 2016 umountnfs.sh*
-rwxr-xr-x 1 root root 1879 1月 20 2016 umountroot*
-rwxr-xr-x 1 root root 1391 4月 20 2017 unattended-upgrades*
-rwxr-xr-x 1 root root 3111 1月 20 2016 urandom*
-rwxr-xr-x 1 root root 1306 5月 16 2018 uuidd*
-rwxr-xr-x 1 root root 485 6月 16 2016 whoopsie*
-rwxr-xr-x 1 root root 2757 1月 20 2017 x11-common*
处理php
$ sudo /etc/init.d/php-fpm status
php-fpm (pid 1461) is running...
$ sudo /etc/init.d/php-fpm stop
Gracefully shutting down php-fpm . done
$ sudo /etc/init.d/php-fpm start
Starting php-fpm done
处理nginx
$ sudo /etc/init.d/nginx status
nginx (pid 17601) is running...
$ sudo /etc/init.d/nginx stop
Stoping nginx... done
$ sudo /etc/init.d/nginx start
Starting nginx... done
处理mysql
$ sudo /etc/init.d/mysql status
● mysql.service - LSB: start and stop MySQL
Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
Active: active (running) since 一 2020-03-30 11:14:07 CST; 26s ago
Docs: man:systemd-sysv-generator(8)
Process: 19060 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
Process: 19127 ExecStart=/etc/init.d/mysql start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/mysql.service
├─19138 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/var --pid-file=/usr/local/mysql/var/jiqing-MacBook.pid
└─19655 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --plugin-dir=/usr/local/mysql/lib/plugin --user=mysq...
3月 30 11:14:06 jiqing-MacBook systemd[1]: Starting LSB: start and stop MySQL...
3月 30 11:14:06 jiqing-MacBook mysql[19127]: Starting MySQL
3月 30 11:14:07 jiqing-MacBook mysql[19127]: . *
3月 30 11:14:07 jiqing-MacBook systemd[1]: Started LSB: start and stop MySQL.
$ sudo /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
$ sudo /etc/init.d/mysql start
[ ok ] Starting mysql (via systemctl): mysql.service.
处理Redis
$ sudo /etc/init.d/redis status
Redis server is running.
$ sudo /etc/init.d/redis stop
Stopping Redis server...
done
$ sudo /etc/init.d/redis start
Starting Redis server...21821:C 30 Mar 2020 11:16:16.892 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
21821:C 30 Mar 2020 11:16:16.892 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=21821, just started
21821:C 30 Mar 2020 11:16:16.892 # Configuration loaded
done
Tips:如果某个服务需要单独处理,可以这样操作!