實驗3服務啓動控制
實驗環境
在虛擬機Linux系統下
實驗目標
檢查系統裏有多少個獨立系統多少個臨時服務
查看bluetooth服務是否啓動
停止bluetooth服務再次查看服務的運行狀態
查看network服務支持哪幾種控制方式
重啓bluetooth、network服務
實驗步驟
1. 檢查系統有多少個獨立服務多少個臨時服務需要利用到管道原理
[root@localhost ~]# ls /etc/init.d/ |wc -l
82 //init.d 所有獨立服務的安裝目錄
[root@localhost ~]# ls /etc/xinetd.d/ |wc -l
21 //xinetd.d所有臨時服務的安裝目錄
2. 查看bluetooth服務前先判斷它是屬於什麼服務再查看它是否啓動
[root@localhost ~]# find /etc/ -namebluetooth
/etc/sysconfig/bluetooth
/etc/bluetooth
/etc/rc.d/init.d/Bluetooth
//經查詢可知bluetooth屬於獨立服務
[root@localhost ~]#/etc/init.d/bluetooth status
//查看狀態也可以用命令service bluetooth status來查看
hcid (pid 3213) 正在運行...
sdpd (pid 3217) 正在運行...
3. 停止bluetooth服務查看它的運行狀態
[root@localhost ~]#/etc/init.d/bluetooth stop
Stopping Bluetooth services: [確定]
//手動停止服務
[root@localhost ~]#/etc/init.d/bluetooth status
hcid 已停
sdpd 已停
4. 查看network服務前也需要查看它屬於什麼服務然後再查看
[root@localhost ~]# find /etc/ -namenetwork
/etc/sysconfig/network
/etc/vmware-tools/scripts/vmware/network
/etc/rc.d/init.d/network
//屬於獨立服務
[root@localhost ~]# /etc/init.d/network
用法/etc/init.d/network{start|stop|restart|reload|status}
//利用/etc/init.d/network命令直接回車可以查找它的用法
5. 重啓bluetooth、network服務。
[root@localhost ~]# /etc/init.d/bluetooth restart
Stopping Bluetooth services: [失敗]
啓動藍牙服務 [確定]
[root@localhost ~]#/etc/init.d/network restart
正在關閉接口 eth0 [確定]
關閉環回接口 [確定]
彈出環回接口 [確定]
彈出界面 eth0
正在決定 eth0 的 IP 信息...完成。
[確定]