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. C语言字符串之无重复字符的最长子串

    题目描述 给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度. 示例 输入: "abcabcbb" 输出: 解释: 因为无重复字符的最长子串是 . 输入: " ...

  2. 【FFMPEG】不要试图用msvc来编译ffmpeg

    原文:http://blog.csdn.net/hn756si/article/details/41147497 出于学习目的,想建一个vs2010工程来编译ffmpeg(http://www.ffm ...

  3. nginx 转发tcp连接

    背景:公司有一套工作流服务(jira,confluence,bitbucket),目前jira,confluence配置的是从nginx网关进行转发,bitbucket配置的是直接解析到该主机,现在计 ...

  4. 学习笔记:CentOS7学习之二十五:shell中色彩处理和awk使用技巧

    目录 学习笔记:CentOS7学习之二十五:shell中色彩处理和awk使用技巧 25.1 Shell中的色彩处理 25.2 awk基本应用 25.2.1 概念 25.2.2实例演示 25.3 awk ...

  5. 初识RedisCluster集群

    为什么需要Redis集群 需要提高更大的并发量 Redis官方提出拥有10万QPS的请求量 如果业务需要Redis拥有100万的QPS 可以通过集群来提升并发量. 需要存储更大的数据量 一般服务器的机 ...

  6. 有关带scala版本的eclipse4.7的下载

    有关带scala版本的eclipse4.7的下载, 你可以直接去: http://scala-ide.org/download/sdk.html ​ 下载下来后是:scala-SDK-4.7.0-vf ...

  7. C++中如何设计一个类只能在堆或者栈上创建对象,面试题

    设计一个类,该类只能在堆上创建对象 将类的构造函数私有,拷贝构造声明成私有.防止别人调用拷贝在栈上生成对象. 提供一个静态的成员函数,在该静态成员函数中完成堆对象的创建 注意 在堆和栈上创建对象都会调 ...

  8. 最新精仿Chinaz中国站长网整站源码带全部数据带采集功能

    用范围: 站长网源码演示地址:php源码运行环境:  phpChinaz站长网对于广大站长来说,是不会陌生的,现在几乎成为了每个站长都必须上的网站了.这次分享的是Chinaz站长网的源码,包含了chi ...

  9. Python爬虫—requests库get和post方法使用

    目录 Python爬虫-requests库get和post方法使用 1. 安装requests库 2.requests.get()方法使用 3.requests.post()方法使用-构造formda ...

  10. 4-MySQL DBA笔记-开发进阶

    第4章 开发进阶 本章将介绍一些重中之重的数据库开发知识.在数据库表设计中,范式设计是非常重要的基础理论,因此本章把它放在最前面进行讲解,而这其中又会涉及另一个重要的概念——反范式设计.接下来会讲述M ...