宝塔常见进程守护方法(运维技巧)

添加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

添加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

THE END
分享
二维码