简体   繁体   English

如何在centos 6中为自动运行命令“ service php-fpm restart”创建crontab?

[英]how to create crontab for auto run command “service php-fpm restart” in centos 6?

I want to run command "service php-fpm restart" each 1 minute and I tried to using contab. 我想每1分钟运行命令“ service php-fpm restart”,并且尝试使用contab。

I tried this code in contab file: 我在contab文件中尝试了以下代码:

0/1 * * * * service php-fpm restart

In the file crontab from /var/spool/con/root, I put these code: 在/ var / spool / con / root目录的crontab文件中,我输入了以下代码:

0 2 * * * chown -R nginx:nginx /home/
0 3 * * * echo 1 > /proc/sys/vm/drop_caches
0 4 * * * reboot
0/1 * * * * service php-fpm restart

All the command almost are running , but the command "service php-fpm restart" not. 所有命令几乎都在运行,但是命令“ service php-fpm restart”却没有。

Besides the big question of why you need to restart every minute (feels like fixing a flat by making sure you have a airpump handy instead of stopping the leak) I wonder how you got a minute of "0/1"? 除了一个大问题,为什么您需要每分钟重新启动一次(感觉就像通过确保有一个气泵而不是阻止泄漏来修理单位一样),我想知道您如何得到一分钟的“ 0/1”? To run something every minute you give it five stars 要每分钟运行某件事,您给它五颗星

* * * * * /sbin/service php-fpm restart

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM