https://serverfault.com/questions/587696/how-to-restart-php-fpm-from-cron

我也遇到了这个问题,想用cron 来启动php-fpm进程(当检测到php-fpm 进程挂掉的时候)

#!/bin/bash
pid=`ps aux|grep php-fpm|grep -v grep|awk '{print $2}'`
if [[ $pid == '' ]]
then
service php5.6-fpm restart
fi

  ----------------------------------------------------

把service php5.6-fpm 这句改为     /etc/init.d/php5.6-fpm restart 就是可以的。也是够奇怪的。:)

------------------------------------------------------------------------------

I'm trying to restart PHP5-FPM periodically using Cron, but am having no luck.

I can restart manually with no problems, using service php5-fpm restart or /usr/sbin/service php5-fpm restart

However, when I use the same command, including using the full path to /usr/sbin/service, nothing happens. The cronjob does run (as I see from the syslog), but PHP5-FPM does not restart.

The relevant line of my root user's crontab looks as follows:

* * * * * /usr/sbin/service php5-fpm restart

I have confirmed with which service that the path to service is indeed /usr/sbin/service.

Why is this not working?

linux 的计划任务 cron的更多相关文章

  1. linux任务计划cron

    linux任务计划cron 1.crontab命令任务计划配置文件 [root@bogon ~]# cat /etc/crontab SHELL=/bin/bash PATH=/sbin:/bin:/ ...

  2. linux任务计划cron、chkconfig工具、systemd管理服务、unit和target介绍

    第8周第1次课(5月14日) 课程内容: 10.23 linux任务计划cron10.24 chkconfig工具10.25 systemd管理服务10.26 unit介绍10.27 target介绍 ...

  3. Linux centos7 linux任务计划cron、chkconfig工具、systemd管理服务、unit介绍、 target介绍

    一.linux任务计划cron crontab -u  -e -l -r 格式;分 时 日 月 周 user command 文件/var/spool/corn/username 分范围0-59,时范 ...

  4. linux的服务管理(centos6和Centos7)和网络管理(网卡配置),计划服务cron

    服务和网络 管理 init  ifcfg ens33 1.服务: Linux系统中提供的功能,统称为服务,如:at服务.cron服务.web服务.FTP服务.sshd服务等. 服务是由已经在运行的进程 ...

  5. Linux任务计划

    Linux任务计划: 一次性任务执行(at.batch): at:定时任务,指定一个时间执行一个任务,只能执行一次. at使用方式: 交互式:让用户在at>提示符输入多个要执行的命令: 批处理: ...

  6. 配置Linux任务计划

    Linux有三种计划任务: at:指定一个时间执行一个任务 (适用一个或多个任务,执行一次后就不用) cron:根据一个时间表自动执行任务 (使用一个或多个任务,周期性执行) 系统级别的计划任务及其扩 ...

  7. Linux操作系统计划任务

    ++++++++++++++++++++++++++++++++++++++++++++++++标题:Linux操作系统的计划任务内容:计划任务分为单次任务和周期性任务,周期任务分为系统级计划任务和用 ...

  8. Linux中计划任务、周期性任务设置

    Linux中计划任务.周期性任务设置 计划任务:指在未来的特定时间里,执行一次某一特定任务.当然,如果同一任务需要在不同时间点执行执行两次.三次或多次,可以视为多个一次看待. 周期性任务:指某一任务需 ...

  9. Linux定时任务计划

    Linux定时任务计划 在使用Linux系统时,我们有时会需要让系统在某个时间去执行特定的任务,这时就需要去了解Linux提供的定时任务功能 种类 Linux的定时任务分为两种:单一型和循环型 单一型 ...

随机推荐

  1. AC日记——明明的烦恼 bzoj 1005

    1005 思路: prufer编码+组合数: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 1005 #de ...

  2. [译]怎样在Vue.js中使用jquery插件

    原文:http://gambardella.info/2016/09/05/guide-how-to-use-vue-js-with-jquery-plugins 使用Vue真的太棒了,但是也有可能使 ...

  3. Ace Admin 学习笔记

    1. jqGrid  提交编辑数据,控制台报:Synchronous XMLHttpRequest on the main thread... jqGrid的选项设置async: true选项: aj ...

  4. 【笔试题】Java 易错题精选

    笔试题 Java 易错题精选 1.写出下列程序的运行结果( )String 不变性Java 值传递 public class Test { public static void main(String ...

  5. thinkphp之自动完成

    1.自动完成 自动完成是ThinkPHP提供用来完成数据自动处理和过滤的方法,使用create方法创建数据对象的时候会自动完成数据处理.  因此,在ThinkPHP使用create方法来创建数据对象是 ...

  6. NOI2015 D1T2 软件包管理器

    题目传送门; 这个貌似是我这个蒟蒻做的第一道NOI系列的题了吧...这题的算法是树链剖分,其实基本上就是很常见的树剖+线段树,题目既然是要求每次安装或卸载改变的软件包的数目,那么就在每次操作前记录下线 ...

  7. Trie树【UVA11362】Phone List

    Description 给定\(n\)个长度不超过\(10\)的数字串,判断是否有两个字符串\(A\)和\(B\),满足\(A\)是\(B\)的前缀,若有,输出NO,若没有,输出YES. 一道\(Tr ...

  8. 洛谷——P4018 Roy&October之取石子

    P4018 Roy&October之取石子 题目背景 Roy和October两人在玩一个取石子的游戏. 题目描述 游戏规则是这样的:共有n个石子,两人每次都只能取p^kpk个(p为质数,k为自 ...

  9. Memory Allocation with COBOL

    Generally, the use of a table/array (Static Memory) is most common in COBOL modules in an applicatio ...

  10. java 反射 获取Class对象的三种方式

    String str="hello world"; //方式一 :通过对象的getClass()方法 Class<?> clazz1 =str.getClass(); ...