关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

BT宝塔常见MySQL/Nginx进程守护方法故障重启(运维技巧)

发布时间:2023/4/1 14:49:49
香港云服务器

宝塔发展了一段时间了,目前看起来越来越有模样了,的确减少了不少的维护和配置的工作量。最近发下演示站 Nginx 总是无故宕机,于是收集了下方 BT 宝塔面板的一些守护代码,放到宝塔计划任务里,一遍故障重启。

添加 MySQL 进程守护脚本方法


  1. pgrep -x mysqld &> /dev/null
  2. if [ $? -ne 0 ];then
  3. bash /www/server/panel/script/rememory.sh
  4. /etc/init.d/mysqld start
  5. fi

添加 redis 进程守护脚本方法

  1. pgrep -x redis &> /dev/null
  2. if [ $? -ne 0 ];then
  3. /etc/init.d/redis start
  4. fi

添加 nginx 进程守护脚本方法

  1. pgrep -x nginx &> /dev/null
  2. if [ $? -ne 0 ];then
  3. /etc/init.d/nginx start
  4. fi

添加 php-fpm 进程守护脚本方法

  1. pgrep -x php-fpm &> /dev/null
  2. if [ $? -ne 0 ];then
  3. /etc/init.d/php-fpm-{52|53|54|55|56|70|71|73} restart
  4. fi

添加 php-fpm 进程守护脚本方法

  1. pgrep -x php-fpm &> /dev/null
  2. if [ $? -ne 0 ];then
  3. /etc/init.d/php-fpm-{52|53|54|55|56|70|71|73} restart
  4. fi