Last active
April 23, 2019 15:12
-
-
Save pandanote-info/3182327b1584d76d26910f0feb28a024 to your computer and use it in GitHub Desktop.
MariaDBのプロセスがOOMKillerにkillされる等の理由で動いていなかった場合に再起動を行い、それをTwitterに起動するためのプログラムを起動するシェルスクリプト。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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