daily pastebin goal
23%
SHARE
TWEET

MySQL Auto Restart (for DirectAdmin)

cyber2friends Oct 17th, 2017 (edited) 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. USER="da_admin"
  4. PASSWD=$(grep "^passwd=" /usr/local/directadmin/conf/mysql.conf | cut -d= -f2)
  5.  
  6. mysql --user="${USER}" --password="${PASSWD}" -e exit 2>/dev/null
  7. SQLSTATUS=`echo $?`
  8.  
  9. if [ $SQLSTATUS -ne "0" ]; then
  10. echo MySQL is down!
  11. /usr/bin/killall mysqld
  12. /etc/init.d/mysqld restart
  13. fi;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top