Production Level Knowledge & Tips

  1. 未分類
  2. 2 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.

未分類 recent post

  1. Install sbt 1.0.0 and run sample template

  2. Visualization of Neural Network and its Train…

  3. [Machine Learning]Created docker image includ…

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

  5. [Hive]Get top n items for each category

関連記事

PAGE TOP