systemdメモ

  • Fedora13マシンを移行しようと、Fedora18をインストールしたところinitdからsystemdに変更になっていて戸惑ったので、とりあえずメモ。
  • http://fedoraproject.org/wiki/Systemd

systemd-cgls

  • 実行中のプロセスがツリー表示されます
├─user
│ └─shinsaka
│   └─4784
│     ├─16090 sshd: shinsaka [priv]
│     ├─16092 sshd: shinsaka@pts/0
│     ├─16093 -bash
│     ├─16154 sudo su -
│     ├─16155 su -
│     ├─16156 -bash
│     ├─17189 systemd-cgls -a
│     └─17190 less
└─system
  ├─1 /usr/lib/systemd/systemd --switched-root --system --deserialize 22
  ├─smb.service
  │ ├─16397 /usr/sbin/smbd
  │ └─16398 /usr/sbin/smbd
  ├─postfix.service
  │ ├─11819 pickup -l -t fifo -u
  │ ├─17504 /usr/libexec/postfix/master
  │ ├─17508 qmgr -l -t fifo -u
  │ └─17514 tlsmgr -l -t unix -u
  ├─httpd.service
  │ ├─  375 /usr/sbin/httpd -DFOREGROUND
  │ ├─  386 /usr/sbin/httpd -DFOREGROUND
  │ ├─10923 /usr/sbin/httpd -DFOREGROUND
  │ ├─13230 /usr/sbin/httpd -DFOREGROUND
  │ ├─13961 /usr/sbin/httpd -DFOREGROUND
  │ ├─15740 /usr/sbin/httpd -DFOREGROUND
  │ ├─15741 /usr/sbin/httpd -DFOREGROUND
  │ ├─15742 /usr/sbin/httpd -DFOREGROUND
...

systemctl

従来の serviceコマンドと chkconfigコマンドの機能を統合したコマンド。

一覧表示

実行中のサービスを表示

systemctl

すべてのサービスを表示

systemctl -a

ユニット一覧を表示

systemctl list-unit-files

サービスのコントロール

httpdを例に記述例を示します。 ちなみに、サービス名はtabキーで補完されます。(http[タブキー]→httpd.service)

開始

systemctl start httpd.service

停止

systemctl stop httpd.service

再起動

systemctl restart httpd.service

設定再読み込み

systemctl reload httpd.service

状態表示

systemctl status httpd.service

自動起動

自動起動に設定されているかどうかを表示

systemctl is-enabled httpd.service

自動起動に設定する

systemctl enable httpd.service

自動起動しないように設定する  systemctl disable httpd.service

facebook slideshare rubygems github qiita