服务控制

    xiaoxiao2022-07-07  151

    问题 查看autofs服务是否启动停止autofs服务,再次查看服务的运行状态查看network服务支持哪几种控制方式重启bluetooth、network服务开启rsync临时服务(需要安装xinetd服务) 方案

    对于服务大家要记得首先要分清的是这个服务是独立服务还是临时服务。

    独立服务的启动脚本一般会放在/etc/init.d/。

    临时服务的配置文件一般会放在/etc/xinetd.d/。

    步骤

    实现此案例需要按照如下步骤进行。

    步骤一:查看autofs服务是否启动

    命令操作如下所示:

    [root@localhost ~]# rpm -ql autofs | grep init   //可以看出autofs为独立服务

    /etc/rc.d/init.d/autofs

    [root@localhost ~]# /etc/init.d/autofs status    //查看服务运行状态

    automount (pid  1433) 正在运行...

    [root@localhost ~]#

    步骤二:停止autofs服务,再次查看服务的运行状态

    命令操作如下所示:

    [root@localhost ~]# /etc/init.d/autofs stop

    停止 automount:[确定]

    [root@localhost ~]# /etc/init.d/autofs status

    automount 已停

    [root@localhost ~]#

    步骤三:查看network服务支持哪几种控制方式

    命令操作如下所示:

    [root@localhost ~]# /etc/init.d/network     //直接敲Enter,会有提示

    用法:/etc/init.d/network {start|stop|status|restart|reload|force-reload}

    [root@localhost ~]#

    步骤四:重启bluetooth、network服务

    命令操作如下所示:

    [root@localhost ~]# /etc/init.d/bluetooth restart    //根据提示它没有restart参数

    用法:/etc/init.d/bluetooth {start|stop}

    [root@localhost ~]# /etc/init.d/bluetooth stop       //停止bluetooth服务

    Stopping Bluetooth services:

    [root@localhost ~]# /etc/init.d/bluetooth start      //开启bluetooth服务

    启动蓝牙设备:

    [root@localhost ~]# /etc/init.d/network restart      //重启network服务

    正在关闭接口 eth0: [确定]

    关闭环回接口: [确定]

    弹出环回接口: [确定]

    弹出界面 eth0: Determining if ip address 192.168.1.1 is already in use for device eth0...

    [确定]

    [root@localhost ~]#

    步骤五:开启rsync临时服务(需要安装xinetd服务)

    分析: 首先rsync为临时服务,系统默认安装rsync服务。但是没有安装管家xinetd服务。需要搭建yum安装xinetd服务,在更改rsync配置文件重启xinetd服务即可。

    命令操作如下所示:

    [root@localhost /]# yum -y install xinetd      //利用yum安装xinetd服务

    [root@localhost /]# vim /etc/xinetd.d/rsync    //编辑rsync配置文件

    [root@localhost /]# grep disable /etc/xinetd.d/rsync

            disable = no

    [root@localhost /]# /etc/init.d/xinetd restart    //重启xinetd服务

    停止 xinetd:[失败]

    正在启动 xinetd:[确定]

    最新回复(0)