宝塔常见进程守护方法

添加MySQL进程守护脚本方法
pgrep -x mysqld &> /dev/null
if [ $? -ne 0 ];then
bash /www/server/panel/script/rememory.sh
/etc/init.d/mysqld start
fi
 
添加redis进程守护脚本方法
pgrep -x redis &> /dev/null
if [ $? -ne 0 ];then
/etc/init.d/redis start
fi
 
添加nginx进程守护脚本方法
pgrep -x nginx &> /dev/null
if [ $? -ne 0 ];then
/etc/init.d/nginx start
fi
 
添加php-fpm进程守护脚本方法
pgrep -x php-fpm &> /dev/null
if [ $? -ne 0 ];then
/etc/init.d/php-fpm-{52|53|54|55|56|70|71|73} restart
fi
 
添加memcached进程守护脚本方法
pgrep -x memcached &> /dev/null
if [ $? -ne 0 ];then
/etc/init.d/memcached restart
fi
托管于 Cloudflare Pages · 由 Hugo 与 Stack 主题驱动
使用 Hugo 构建
主题 Stack 由 Jimmy 设计