25. Open Cloud Campus
25
Linux女子部 systemd徹底入門!
Unitの一覧表示 (2)
# systemctl list-units (「list-units」は省略可)
– 現在有効な(有効であるべき)Unitとその状態を一覧表示します。
– --typeオプションで特定タイプのUnitのみを表示します。
# systemctl --type=service
UNIT LOAD ACTIVE SUB DESCRIPTION
atd.service loaded active running Job spooling tools
auditd.service loaded active running Security Auditing Service
avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack
chronyd.service loaded active running NTP client/server
crond.service loaded active running Command Scheduler
dbus.service loaded active running D-Bus System Message Bus
fedora-readonly.service loaded active exited Configure read-only root supp
firewalld.service loaded active running firewalld - dynamic firewall
[email protected] loaded active running Getty on tty1
irqbalance.service loaded active running irqbalance daemon
lvm2-lvmetad.service loaded active running LVM2 metadata daemon
lvm2-monitor.service loaded active exited Monitoring of LVM2 mirrors, s
mcelog.service loaded active running Machine Check Exception Loggi
NetworkManager.service loaded active running Network Manager
polkit.service loaded active running Authorization Manager
rngd.service loaded failed failed Hardware RNG Entropy Gatherer
rpcbind.service loaded active running RPC bind service
・・・
systemd-v...le-setup.service loaded active exited Setup Virtual Console
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
31 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
26. Open Cloud Campus
26
Linux女子部 systemd徹底入門!
Unitの基本操作 (1)
# systemctl enable/disable <Unit名>
– Unitの自動起動を有効化/無効化します。
– 実際には、「WantedBy=」で指定されたUnitへの依存関係を設定/削除します。
# systemctl start/stop/restart <Unit名>
– 指定のUnitをその場で、起動/停止/再起動します。
– reloadコマンドは、Unit設定ファイルでreloadの動作が定義されている場合のみ使用できます。
# systemctl status <Unit名>
– Unitの実行状態を表示します。
# systemctl status httpd.service
httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
Active: active (running) since 日 2013-11-03 15:59:37 JST; 16s ago
Main PID: 4621 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: name=systemd:/system/httpd.service
├─4621 /usr/sbin/httpd -DFOREGROUND
├─4622 /usr/sbin/httpd -DFOREGROUND
├─4623 /usr/sbin/httpd -DFOREGROUND
├─4624 /usr/sbin/httpd -DFOREGROUND
├─4625 /usr/sbin/httpd -DFOREGROUND
└─4626 /usr/sbin/httpd -DFOREGROUND
11月 03 15:59:36 fedora19 systemd[1]: Starting The Apache HTTP Server...
11月 03 15:59:36 fedora19 httpd[4621]: AH00557: httpd: apr_sockaddr_info_ge...9
11月 03 15:59:36 fedora19 httpd[4621]: AH00558: httpd: Could not reliably d...e
11月 03 15:59:37 fedora19 systemd[1]: Started The Apache HTTP Server.
関連する直近のログを表示
関連するデーモンプロセスを表示
27. Open Cloud Campus
27
Linux女子部 systemd徹底入門!
Unitの基本操作 (2)
# systemctl daemon-reload
– Unitの設定ファイルを変更した際に、変更内容をsystemdに認識させます。
chkconfigコマンド/serviceコマンドは、対応するsystemctlコマンドに変換されます。
サービス起動スクリプトで標準外のオプションを使用していたものは、systemd環境では使
用できなくなります。
– 例えば、PostgreSQLデータベースクラスタ初期化は、postgresql-setupコマンドを使用します。
• RHEL6: # service postgresql initdb
• Fedora19: # postgresql-setup initdb
# chkconfig sshd off
情報:'systemctl disable sshd.service'へ転送しています。
rm '/etc/systemd/system/multi-user.target.wants/sshd.service'
# chkconfig sshd on
情報:'systemctl enable sshd.service'へ転送しています。
ln -s '/usr/lib/systemd/system/sshd.service' '/etc/systemd/system/multi-user.target.wants/sshd.service'
# service sshd stop
Redirecting to /bin/systemctl stop sshd.service
# service sshd start
Redirecting to /bin/systemctl start sshd.service