systemdでのサービスの起動、停止、状況確認

systemdでサービス等の起動、停止を行う際にはsystemctlコマンドを使用する。systemdではユニットという単位で管理している。ここではserviceでしか作業していないが他にもdevice、mountなど他にもある。

実行中のユニットを表示

# systemctl
UNIT                              LOAD   ACTIVE SUB     DESCRIPTION
proc-sys-fs-binfmt_misc.automount loaded active waiting Arbitrary Executable File Formats File
(以下省略)

インストールされているユニットを表示

# systemctl list-unit-files
UNIT FILE                         STATE
proc-sys-fs-binfmt_misc.automount static
(以下省略)

ユニット(=firewalld.service)の起動

# systemctl start firewalld.service
#

serviceは省略して以下のようにもできる。

# systemctl start firewalld
#

状況確認

起動していることを確認する。

# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
   Active: active (running) since 土 2014-11-22 10:07:39 JST; 3min 35s ago
 Main PID: 4969 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─4969 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
(以下省略)

ユニット(=firewalld.service)の停止

# systemctl stop firewalld
#

状況確認

停止していることを確認する。

# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
   Active: inactive (dead) since 土 2014-11-22 10:16:32 JST; 17s ago
  Process: 4969 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
 Main PID: 4969 (code=exited, status=0/SUCCESS)
(以下省略)

0 件のコメント :

コメントを投稿