systemctl automatically restart service

 Pothi Kalimuthu  Linux  October 9, 2016 0 Minutes

References:

  1. Ensure systemd services restart on failure by Jon Archer
  2. php-fpm systemd unit with auto-restart by Juan Luis Boya García
  3. systemd Project Web Page

systemd is a system and service manager that runs as PID 1 and starts the rest of the system and services. The main command used to introspect and control systemd is systemctl.

Basically do the following to let a service restart automatically…

  • Edit /lib/systemd/system/name.service file
  • Insert “Restart=on-failure” under the section “Service”. Save the file
  • Execute the command… systemctl daemon-reload
  • Execute the command… systemctl restart name_of_the_service
  • (optional) try killing the process now

See https://wiki.archlinux.org/index.php/Systemd#Examples for more examples.

systemctl automatically restart service的更多相关文章

  1. Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details

    thinkphp 在Apache上配置启用伪静态,重启Apache1 restart 竟然失败了,报错 Job for httpd.service failed because the control ...

  2. Linux 重启网卡失败 Job for network.service failed because the control process exited with error code. See "systemctl status network.service" and "journalctl -xe" for details.

    linux下重启网卡使用命令 : service network restart 时报错: [root@slave01 hadoop]# service network restart Startin ...

  3. Centos7下的systemctl命令与service和chkconfig

    博主使用的操作系统是最新的CentOS 7,所以可能和网上一些老的博文有一定出入,那是因为版本更新的原因. 这里写图片描述1 service service命令用于对系统服务进行管理,比如启动(sta ...

  4. 通过 systemctl 设置自定义 Service

    如果要在Linux 上设置一个开机自启,出现问题自动重启,并且有良好日志的程序,比较流行的方法有 supervisord.systemd,除此之外,还有 upstart.runit 等类似的工具. 但 ...

  5. systemctl enable rc-local.service error

    /******************************************************************************* * systemctl enable ...

  6. 启动Nginx服务失败:Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

    首次接触nginx,安装完使用命令 service nignx restart  后,出现这个错误,并按照提示给出的命令查看错误详情  systemctl status nginx.service   ...

  7. 对比centos7的systemctl和其他service+chkconfig

    syetemctl就是service和chkconfig这两个命令的整合,在CentOS 7就开始被使用了.systemctl 是系统服务管理器命令,它实际上将 service 和 chkconfig ...

  8. 有关linux中出现systemctl status network.service" and "journalctl -xe" for details.

    Job for network.service failed because the control process exited with error code >**[root@mina0 ...

  9. Linux系统Docker启动问题Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service"

    在Liunx中使用Docker, 注: Liunx使用的是在虚拟机下的centOS7版本在刚开始安装Docker时没有任何错误, 但是在后续的docker启动过程中, 出现以下问题: [root@zk ...

随机推荐

  1. ORACLE initialization or shutdown in progress 错误解决办法

    第一步,运行cmd 第一步.sqlplus /NOLOG第二步.SQL>connect sys/change_on_install as sysdba'/提示:已成功第三步.SQL>shu ...

  2. 剑指offer42:数组和一个数字S,输出两个数的乘积最小的

    1 题目描述 输入一个递增排序的数组和一个数字S,在数组中查找两个数,使得他们的和正好是S,如果有多对数字的和等于S,输出两个数的乘积最小的. 输出描述: 对应每个测试案例,输出两个数,小的先输出. ...

  3. Photon Server 实现注册与登录(二) --- 服务端代码整理

    一.有的代码前端和后端都会用到.比如一些请求的Code.使用需要新建项目存放公共代码. 新建项目Common存放公共代码: EventCode :存放服务端自动发送信息给客户端的code Operat ...

  4. pthread_cancel 相关

    假设线程A对线程B发出了一个取消请求.通过如下函数: #include <pthread.h> int pthread_cancel(pthread_t thread); 参数: thre ...

  5. MyBatis Java不同方式加载文件时的路径格式问题、Mybatis中加载.properties文件

    public class LoadPropTest { public static void main(String[] args) throws IOException { //一.Properti ...

  6. C#字典转对象

    /// <summary> /// Assign parameters to specified objects /// </summary> /// <typepara ...

  7. hdu 2821 学习一点dfs的小技巧吧。。 还是自己太弱了

    #include<iostream> #include<cstdio> #include<cstring> using namespace std; int r,c ...

  8. 10-MySQlL DBA笔记-基础知识

    第四部分 运维篇 首先来了解一下数据库的定义,数据库是高效的.可靠的.易用的.安全的多用户存储引擎,我们可以通过它访问大量的持久化数据.我们管理和维护数据库,本质上也是要确保如上的特性,尽可能地保证数 ...

  9. 手机号码归属地查询API

    <?php function object_array($array){ if(is_object($array)){ $array = (array)$array; } if(is_array ...

  10. c# winform找窗体

    Application.OpenForms["frm"],一句话就找到窗体