Systemctlが死んだプロセスを再開できますか?それとも監督官が介入しますか?

Systemctlが死んだプロセスを再開できますか?それとも監督官が介入しますか?

私の研究では、SupervisorとSystemctlは互換性があるようには見えませんが、特に機能が重複しており、どちらも他のプロセスを開始するために使用できます。ただし、スーパーバイザは何らかの理由で終了したアプリケーションを再起動できます。 systemctlがこれを実行できることを示すエントリが見つかりません。

Systemctlを使用して死んだプロセスを再開できますか?

また、ほとんどの人はSystemctlにPostgresとNginxまたはApacheを追加し、Supervisorにアプリケーションを追加するようです。なぜこれですか?監督者が死んだら再開できるように、これらすべてを監督者に追加する必要はありませんか?

ベストアンサー1

systemctl通常、設定と制御に使用されるコマンドですsystemd

システム単位プロセスが終了したときに実行する操作の指示を含めることができます。

たとえば、RedHat 7 の場合、デフォルトの rsyslogd インストールには、以下を含む単位ファイルが含まれます。

[Service]
....
Restart=on-failure

その一部として。

からman systemd.service

   Restart=
       Configures whether the service shall be restarted when the service
       process exits, is killed, or a timeout is reached. The service
       process may be the main service process, but it may also be one of
       the processes specified with ExecStartPre=, ExecStartPost=,
       ExecStop=, ExecStopPost=, or ExecReload=. When the death of the
       process is a result of systemd operation (e.g. service stop or
       restart), the service will not be restarted. Timeouts include
       missing the watchdog "keep-alive ping" deadline and a service
       start, reload, and stop operation timeouts.

       Takes one of no, on-success, on-failure, on-abnormal, on-watchdog,
       on-abort, or always. If set to no (the default), the service will
       not be restarted. 

systemd比較的新機能なので、人々はその機能を認識できないかもしれません。さらに、彼らは知らないかもしれませんユーザーユーザーが自分で作業を実行できるようにする単位。

supervisord古いプログラムなので、人々はこれについてもっとよく知っていて、10年間使ってきましたが、何の変更も必要ないと思います。

おすすめ記事