プログラミング + アカデミック + 何か面白いこと

  1. Programming
  2. 363 view

[Shell][mysql]Monitor mysqld process and reboot it if it’s needed

Target

mysqld die sometimes at my web app,
So I tried to make a shell script to reboot the process if the process died.

source

#!/bin/sh

PROCESS=`ps -ef | grep /usr/sbin/mysqld | grep -v grep | wc -l`
if test $PROCESS -eq 0
then
        LOG=`sudo /etc/init.d/mysql start`
fi

Make this run at a cycle with crontab.

Programming recent post

  1. Install sbt 1.0.0 and run sample template

  2. [Machine Learning]Created docker image includ…

  3. [Node.js]How to write batch script with Node.…

  4. [Play][Scala]Develop Request Driven Batch Usi…

  5. [OpenCV][Ruby]Auto check web page design corr…

関連記事

PAGE TOP