怎么\通过计划任务定期释放PHP占用的内存

小编给大家分享一下怎么\通过计划任务定期释放PHP占用的内存,希望大家阅读完这篇文章后大所收获,下面让我们一起去探讨吧!

\

通过计划任务定期释放PHP占用的内存

在计划任务中添加任务,选择周期,如每周一 3时30分执行

选执行Shell脚本,粘贴以下Shell脚本

if [ -f /etc/init.d/php-fpm-52 ];then
        service php-fpm-52 reload
fi
if [ -f /etc/init.d/php-fpm-53 ];then
       service php-fpm-53 reload
fi
if [ -f /etc/init.d/php-fpm-54 ];then
       service php-fpm-54 reload
fi
if [ -f /etc/init.d/php-fpm-55 ];then
        service php-fpm-55 reload
fi
if [ -f /etc/init.d/php-fpm-56 ];then
        service php-fpm-56 reload
fi
if [ -f /etc/init.d/php-fpm-70 ];then
      service php-fpm-70 reload
fi
myDate=`date +"%Y-%m-%d %H:%M:$S"`
echo "★[$myDate] PHP内存回收成功!"
echo '------------------------------------------------------------------------------';

看完了这篇文章,相信你对怎么\通过计划任务定期释放PHP占用的内存有了一定的了解,想了解更多相关知识,欢迎关注行业资讯频道,感谢各位的阅读!