vps交流

小内存VPS必备——Mysql被杀自动重启脚本


低于2G的小内存的VPS,流量过大Mysql容易被杀

  1. #!/bin/bash
  2. pgrep -x mysqld &> /dev/null
  3. if [ $? -ne 0 ]
  4. then
  5. echo “At time: `date +%Y%m%d-%H:%M:%S` MySQL is stop .”>> restartmysql.log
  6. systemctl restart mariadb.service
  7. else
  8. echo “At time: `date +%Y%m%d-%H:%M:%S` MySQL server is running .”>> restartmysql.log
  9. fi

复制代码

  1. –restart=unless-stopped

复制代码

赞(0)
版权声明:本贴采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
帖子名称:《小内存VPS必备——Mysql被杀自动重启脚本》
帖子链接:https://bbs.toot.su/75269.html

相关推荐