Skip to content

Instantly share code, notes, and snippets.

@pandanote-info pandanote-info/sqlcheck.sh
Last active Apr 23, 2019

Embed
What would you like to do?
MariaDBのプロセスがOOMKillerにkillされる等の理由で動いていなかった場合に再起動を行い、それをTwitterに起動するためのプログラムを起動するシェルスクリプト。
#!/bin/sh
CHECK_CMD=`ps ax | grep mysqld | grep -v grep`
CURRENT_DIR=`pwd`
CURRENT_TIME=`date +%Y%m%d%H%M%S`
CHECK_CMD=
if [ -z "${CHECK_CMD}" ]; then
systemctl restart mariadb
if [ "$?" = 0 ]; then
python3 ${CURRENT_DIR}/sqlcheck_publisher.py
fi
fi
find /var/log/sqlcheck -atime +30 -exec rm -f '{}' \;
touch /var/log/sqlcheck/sqlcheck_${CURRENT_TIME}.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.