0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Linux基礎】自動起動設定コマンドまとめ

0
Posted at

はじめに

自動起動設定コマンドが多く混同したので、整理します。
本記事では、chkconfig, update-rc.d, insserv等の自動起動設定コマンドを取り扱います。

① ディストリビューション対応表

自動起動設定コマンドは、ディストリビューションによって異なるため対応をはじめに把握しましょう。

系統 コマンド
Red Hat系(RHEL6、CentOS6など) chkconfig
Debian系(旧) update-rc.d
SUSE系 insserv
Debian6以降 / Ubuntu / SUSE insserv
現在主流(多くのLinux) systemctl

② 使い方まとめ

次に、それぞれのコマンドの使い方、特徴をとらえます。

■ chkconfig(Red Hat系)

目的 コマンド
ON(自動起動) chkconfig httpd on
OFF chkconfig httpd off
特定ランレベル chkconfig --level 35 httpd on
状態確認 chkconfig --list
追加 chkconfig --add httpd
削除 chkconfig --del httpd
  • ON/OFFが簡単
  • ランレベル2〜5がデフォルト

■ update-rc.d(Debian旧)

目的 コマンド
デフォルト登録 update-rc.d ssh defaults
削除 update-rc.d -f ssh remove
細かい設定 update-rc.d ssh start 20 2 3 4 5 . stop 80 0 1 6 .
  • rcディレクトリを直接操作
  • 優先順位・ランレベル指定が必要

■ insserv(SUSE / 新しいDebian)

目的 コマンド
ON insserv ssh
OFF insserv -r ssh
依存関係更新 insserv
  • INIT INFOを読み自動設定
  • 依存関係も自動
  • 設定が簡単

■ systemctl(現在の主流)

目的 コマンド
ON systemctl enable ssh
OFF systemctl disable ssh
起動 systemctl start ssh
停止 systemctl stop ssh
状態 systemctl status ssh

現在はほぼこれ(RHEL7以降、Ubuntuなど)


まとめ

RedHat → chkconfig  
Debian旧 → update-rc.d  
SUSE → insserv  
現在 → systemctl
  • chkconfig:ON/OFFだけ
  • update-rc.d:細かく設定
  • insserv:自動
  • systemctl:全部
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?