CentOS 5.x などで利用されていた init は以下の問題をもっていたため、 最近では systemd や Upstart が用いられている。
起動・停止スクリプトを非同期に実行することで、処理時間を短縮しています。
従来の起動・停止スクリプトと互換があり、多くのディストリビューションが採用しています。
RHEL/CentOS 6.x, Ubuntu 6.10+, Debian 6.0+
upstart 詳細
RedHat のエンジニアによって新規に設計されたサービス起動システムです。
upstart の並行起動をより進化させ、ソケット起動とバス起動ができるようになっています。
また起動時に必要なディスクのマウントや、ログの管理など管理する範囲が格段に増えています。
伴い、/etc/init.d/ スクリプトは廃止されサービスは cgroups によって厳密に監視出来るようになりました。
RHEL/CentOS 7.x, Fedora 15+, openSUSE 12.1+
比較項目 | init,Upstart | systemd |
---|---|---|
定義ファイル | /etc/inittab /etc/init.d/* |
/usr/lib/systemd/system/*.service |
サービス起動 | /etc/init.d/サービス start... service サービス名 start... |
systemd start... サービス名 service サービス start... |
自動起動 | chkconfig --level ランレベル on|off | systemctl enable|disable サービス |
一覧表示 | chkconfig --list | systemctl list-unit-files |
レベル表示 | runlevel | systemctl get-default |
# service サービス start... 又は # systemctrl start... サービスプロセスは cgroups で管理され、status 表示ではログも統合されています。
$ service sshd status Redirecting to /bin/systemctl status sshd.service sshd.service - OpenSSH server daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled) Active: active (running) since Sat 2014-12-06 11:06:22 JST; 3min 21s ago Process: 654 ExecStartPre=/usr/sbin/sshd-keygen (code=exited, status=0/SUCCESS) Main PID: 666 (sshd) CGroup: /system.slice/sshd.service `-666 /usr/sbin/sshd -D Dec 06 11:06:22 localhost.localdomain systemd[1]: Started OpenSSH server daemon. Dec 06 11:06:23 localhost.localdomain sshd[666]: Server listening on 0.0.0.0.... Dec 06 11:06:23 localhost.localdomain sshd[666]: Server listening on :: port 22. Dec 06 11:08:03 localhost.localdomain sshd[1494]: Accepted password for stude... Hint: Some lines were ellipsized, use -l to show in full.
# systemctl enable|disable サービス名 $ chkconfig --list Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'. To see services enabled on particular target use 'systemctl list-dependencies [target]'. netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off network 0:off 1:off 2:off 3:off 4:off 5:off 6:off $ systemctl list-unit-files UNIT FILE STATE proc-sys-fs-binfmt_misc.automount static dev-hugepages.mount static : session-2.scope static abrt-ccpp.service enabled abrt-oops.service enabled abrt-pstoreoops.service disabled : # systemctl disable smartd rm '/etc/systemd/system/multi-user.target.wants/smartd.service'