Debian でサービスが起動しない場合にデバッグする方法

Debian でサービスが起動しない場合にデバッグする方法

私は新しいDebianの不安定版ベースのディストリビューションにapache2をインストールしています。Apache自体は問題なく動作しています。

sudo service apache2 start 

それが実現し、すべてがうまくいきます。

しかし、そのためのサービスは起動のたびに起動に失敗します。

ここでエラーをトレースするにはどうすればいいでしょうか?

エラーログ:

[Sun Jan 15 14:51:06.685936 2017] [mpm_prefork:notice] [pid 2208] AH00169: caught SIGTERM, shutting down
[Sun Jan 15 14:51:47.842447 2017] [mpm_prefork:notice] [pid 2200] AH00163: Apache/2.4.23 (Debian) configured -- resuming normal operations
[Sun Jan 15 14:51:48.145808 2017] [core:notice] [pid 2200] AH00094: Command line: '/usr/sbin/apache2'
[Sun Jan 15 14:55:25.766188 2017] [mpm_prefork:notice] [pid 3257] AH00163: Apache/2.4.23 (Debian) configured -- resuming normal operations
[Sun Jan 15 14:55:25.801736 2017] [core:notice] [pid 3257] AH00094: Command line: '/usr/sbin/apache2'
[Sun Jan 15 16:08:15.031691 2017] [mpm_prefork:notice] [pid 2316] AH00163: Apache/2.4.23 (Debian) configured -- resuming normal operations
[Sun Jan 15 16:08:15.043756 2017] [core:notice] [pid 2316] AH00094: Command line: '/usr/sbin/apache2'
[Mon Jan 16 11:26:33.007967 2017] [mpm_prefork:notice] [pid 2278] AH00163: Apache/2.4.23 (Debian) configured -- resuming normal operations
[Mon Jan 16 11:26:33.013972 2017] [core:notice] [pid 2278] AH00094: Command line: '/usr/sbin/apache2'
 [Tue Jan 17 08:07:35.149382 2017] [mpm_prefork:notice] [pid 3517] AH00163: Apache/2.4.23 (Debian) configured -- resuming normal operations
 [Tue Jan 17 08:07:35.152372 2017] [core:notice] [pid 3517] AH00094: Command line: '/usr/sbin/apache2'

サービス障害のデバッグに役立つ他のファイルは何ですか?

答え1

  1. 実行によってサービスが有効になっていることを確認しますsystemctl --no-page -t service -a | grep apache2
  2. 無効になっている場合は有効にして開始します。systemctl enable apache2 && systemctl start apache2
  3. サービスが機能していることを確認するsystemctl status apache2
  4. 必要に応じて、apache2.service 関連のログを次のように確認できます。journalctl --no-page -u apache2.service 注記.-fキーはjournalctltail

答え2

システムに障害はなく、設計通りに動作しています。おそらく、有効にする起動時にサービスが開始されるようにします。

systemctl enable service

systemctl/systemd のドキュメントをじっくり読んでみるのも良いかもしれません。

関連情報