如题所述
第1个回答 2021-03-31
1、service命令
service命令其实是去/etc/init.d目录下,去执行相关程序
查看/etc/init.d目录下有哪些文件
[root@VM_0_11_centos init.d]# ll /etc/init.d/
total 40
-rw-r--r-- 1 root root 18281 Mar 29 2019 functions
-rwxr-xr-x 1 root root 4569 Mar 29 2019 netconsole
-rwxr-xr-x 1 root root 7923 Mar 29 2019 network
-rw-r--r-- 1 root root 1160 Oct 19 00:48 README
[root@VM_0_11_centos init.d]#
查看脚本文件都有哪些命令
# See how we were called.
case "$1" in
start)
[ "$EUID" != "0" ] && exit 4
rc=0
# IPv6 hook (pre IPv4 start)
if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then
/etc/sysconfig/network-scripts/init.ipv6-global start pre
fi
apply_sysctl
#tell NM to reload its configuration
[root@VM_0_11_centos ~]# /etc/init.d/network start
Starting network (via systemctl): [ OK ]
[root@VM_0_11_centos ~]# service restart network
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
[root@VM_0_11_centos ~]#
2、systemctl命令
systemd是Linux系统最新的初始化系统(init),作用是提高系统的启动速度,尽可能启动较少的进程,尽可能更多进程并发启动。
systemd对应的进程管理命令是systemctl
service命令其实是去/etc/init.d目录下,去执行相关程序
查看/etc/init.d目录下有哪些文件
[root@VM_0_11_centos init.d]# ll /etc/init.d/
total 40
-rw-r--r-- 1 root root 18281 Mar 29 2019 functions
-rwxr-xr-x 1 root root 4569 Mar 29 2019 netconsole
-rwxr-xr-x 1 root root 7923 Mar 29 2019 network
-rw-r--r-- 1 root root 1160 Oct 19 00:48 README
[root@VM_0_11_centos init.d]#
查看脚本文件都有哪些命令
# See how we were called.
case "$1" in
start)
[ "$EUID" != "0" ] && exit 4
rc=0
# IPv6 hook (pre IPv4 start)
if [ -x /etc/sysconfig/network-scripts/init.ipv6-global ]; then
/etc/sysconfig/network-scripts/init.ipv6-global start pre
fi
apply_sysctl
#tell NM to reload its configuration
[root@VM_0_11_centos ~]# /etc/init.d/network start
Starting network (via systemctl): [ OK ]
[root@VM_0_11_centos ~]# service restart network
The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
[root@VM_0_11_centos ~]#
2、systemctl命令
systemd是Linux系统最新的初始化系统(init),作用是提高系统的启动速度,尽可能启动较少的进程,尽可能更多进程并发启动。
systemd对应的进程管理命令是systemctl