systemd(chkconfigなど)なしでこれをどのように達成できますか?
PostgreSQL、Mongod、RabbitMQを再起動したいです。
ベストアンサー1
サービスを自動的に復元するには、を使用できますmonit
。これは非常に軽くて使いやすいサービスです。
Debian にインストールするには:
sudo apt-get install monit
設定については、/etc/monit/monitrc
サービスを編集して再起動できます。
たとえば、デーモンが実行されているかどうか、サービスが適切なポートで応答するかどうかを監視し、PostgreSQL、RabbitMQ、および mongoDB の自動回復を設定します。
check process postgres with pidfile /var/postgres/postmaster.pid group database start program = "/etc/init.d/postgresql start" stop program = "/etc/init.d/postgresql stop" if failed unixsocket /var/run/postgresql/.s.PGSQL.5432 protocol pgsql then restart if failed host 192.168.1.1 port 5432 protocol pgsql then restart check host mongodb with address localhost start program = "/usr/bin/sudo /opt/database/mongo/bin/mongod" stop program = "/usr/bin/sudo /usr/bin/pkill -f mongod" if failed port 28017 protocol HTTP request / with timeout 10 seconds then start check process rabbitmq-server with pidfile /var/run/rabbitmq.pid group rabbitmq start program "/etc/init.d/rabbitmq-server start" stop program "/etc/init.d/rabbitmq-server stop" if failed port 5672 type tcp then restart if 3 restarts within 3 cycles then timeout
より多くのサービスが必要な場合は、以下を参照してください。モニタリングウィキ
Monitを使用すると、ルールに従って電子メールを送信でき、サーバーの負荷内で機能します。誰にでも良い調査をお勧めします。