特黄特色三级在线观看免费,看黄色片子免费,色综合久,欧美在线视频看看,高潮胡言乱语对白刺激国产,伊人网成人,中文字幕亚洲一碰就硬老熟妇

學習啦 > 學習電腦 > 操作系統(tǒng) > Linux教程 > linux的service命令

linux的service命令

時間: 佳洲1085 分享

linux的service命令

  linux下的service命令主要是對系統(tǒng)服務進行管理,下面由學習啦小編為大家整理了linux的service命令的相關知識,希望對大家有幫助!

  linux的service命令

  用途說明

  service命令用于對系統(tǒng)服務進行管理,比如啟動(start)、停止(stop)、重啟(restart)、查看狀態(tài)(status)等。相關的命令還包括chkconfig、ntsysv等,chkconfig用于查看、設置服務的運行級別,ntsysv用于直觀方便的設置各個服務是否自動啟動。service命令本身是一個shell腳本,它在/etc/init.d/目錄查找指定的服務腳本,然后調用該服務腳本來完成任務。

  看看下面的手冊頁可能更加清楚的了解service的內幕:service運行指定服務(稱之為System V初始腳本)時,把大部分環(huán)境變量去掉了,只保留LANG和TERM兩個環(huán)境變量,并且把當前路徑置為/,也就是說是在一個可以預測的非常干凈的環(huán)境中運行服務腳本。這種腳本保存在/etc/init.d目錄中,它至少要支持start和stop命令。

  man service 寫道

  service(8) service(8)

  NAME

  service - run a System V init script

  SYNOPSIS

  service SCRIPT COMMAND [OPTIONS]

  service --status-all

  service --help | -h | --version

  DESCRIPTION

  service runs a System V init script in as predictable environment as possible, removing most environment vari-

  ables and with current working directory set to /.

  The SCRIPT parameter specifies a System V init script, located in /etc/init.d/SCRIPT. The supported values of

  COMMAND depend on the invoked script, service passes COMMAND and OPTIONS it to the init script unmodified. All

  scripts should support at least the start and stop commands. As a special case, if COMMAND is --full-restart,

  the script is run twice, first with the stop command, then with the start command.

  service --status-all runs all init scripts, in alphabetical order, with the status command.

  FILES

  /etc/init.d

  The directory containing System V init scripts.

  ENVIRONMENT

  LANG, TERM

  The only environment variables passed to the init scripts.

  SEE ALSO

  chkconfig(8), ntsysv(8)

  Jan 2006 service(8)

  常用方式

  格式:service <service>

  打印指定服務<service>的命令行使用幫助。

  格式:service <service> start

  啟動指定的系統(tǒng)服務<service>

  格式:service <service> stop

  停止指定的系統(tǒng)服務<service>

  格式:service <service> restart

  重新啟動指定的系統(tǒng)服務<service>,即先停止(stop),然后再啟動(start)。

  格式:chkconfig --list

  查看系統(tǒng)服務列表,以及每個服務的運行級別。

  格式:chkconfig <service> on

  設置指定服務<service>開機時自動啟動。

  格式:chkconfig <service> off

  設置指定服務<service>開機時不自動啟動。

  格式:ntsysv

  以全屏幕文本界面設置服務開機時是否自動啟動。

  linux的service命令使用示例

  示例一 網(wǎng)絡重啟

  當修改了主機名、ip地址等信息時,經(jīng)常需要把網(wǎng)絡重啟使之生效。

  [root@node34 root]# service network

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

  [root@node34 root]# service network status

  配置設備:

  lo eth0

  當前的活躍設備:

  lo eth0

  [root@node34 root]# service network restart

  正在關閉接口 eth0: [ 確定 ]

  關閉環(huán)回接口: [ 確定 ]

  設置網(wǎng)絡參數(shù): [ 確定 ]

  彈出環(huán)回接口: [ 確定 ]

  彈出界面 eth0: [ 確定 ]

  [root@node34 root]#

  示例二 重啟MySQL

  [root@node34 root]# service mysql

  mysql: unrecognized service

  [root@node34 root]# service mysqld

  用法:/etc/init.d/mysqld {start|stop|status|condrestart|restart}

  [root@node34 root]# service mysqld status

  mysqld (pid 1638) 正在運行...

  [root@node34 root]# service mysqld restart

  停止 MySQL: [ 確定 ]

  啟動 MySQL: [ 確定 ]

  [root@node34 root]#

3632022