我们对service和chkconfig两个命令都不陌生,systemctl 是管制服务的主要工具, 它整合了chkconfig 与 service功能于一体。

systemctl is-enabled iptables.service
systemctl is-enabled servicename.service #查询服务是否开机启动
systemctl enable *.service #开机运行服务
systemctl disable *.service #取消开机运行
systemctl start *.service #启动服务
systemctl stop *.service #停止服务
systemctl restart *.service #重启服务
systemctl reload *.service #重新加载服务配置文件
systemctl status *.service #查询服务运行状态
systemctl --failed #显示启动失败的服务

注:*代表某个服务的名字,如http的服务名为httpd

例如在CentOS 7 上安装http

[root@CentOS7 ~]# yum -y install httpd
启动服务(等同于service httpd start)
systemctl start httpd.service
停止服务(等同于service httpd stop)
systemctl stop httpd.service
重启服务(等同于service httpd restart)
systemctl restart httpd.service
查看服务是否运行(等同于service httpd status)
systemctl status httpd.service
开机自启动服务(等同于chkconfig httpd on)
systemctl enable httpd.service
开机时禁用服务(等同于chkconfig httpd on)
systemctl disable httpd.service
查看服务是否开机启动 (等同于chkconfig --list)

Linux centOS Ubuntu --- 使用systemctl添加开机启动的更多相关文章

  1. Linux/CentOS 服务安装/卸载,开机启动chkconfig命令详解|如何让MySQL、Apache开机启动?

    chkconfig chkconfig在命令行操作时会经常用到.它可以方便地设置和查询不同运行级上的系统服务.这个可要好好掌握,用熟练之后,就可以轻轻松松的管理好你的启动服务了. 注:谨记chkcon ...

  2. systemctl添加开机启动

    我们对service和chkconfig两个命令都不陌生,systemctl 是管制服务的主要工具, 它整合了chkconfig 与 service功能于一体. systemctl is-enable ...

  3. 不同linux系统添加开机启动程序的命令

    see http://phpcj.org/blog/%E4%B8%8D%E5%90%8Clinux%E7%B3%BB%E7%BB%9F%E6%B7%BB%E5%8A%A0%E5%BC%80%E6%9C ...

  4. (转) CentOS 7添加开机启动服务/脚本

    CentOS 7添加开机启动服务/脚本 原文:http://blog.csdn.net/wang123459/article/details/79063703 一.添加开机自启服务 在CentOS 7 ...

  5. ubuntu 添加开机启动服务

    新建umpserver.service [Unit] Description=UMPServer After=syslog.target network.target remote-fs.target ...

  6. Linux 添加开机启动项的三种方法

    linux 添加开机启动项的三种方法. (1)编辑文件 /etc/rc.local 输入命令:vim /etc/rc.local 将出现类似如下的文本片段: #!/bin/sh## This scri ...

  7. Centos 7 添加开机启动

    1.添加启动服务 添加docker开机启动服务 [root@localhost ~]# systemctl enable docker.serviceCreated symlink from /etc ...

  8. 关于Ubuntu运行级别、开机启动脚本的说明

    关于Ubuntu运行级别.开机启动脚本的说明 目录简介 1.1介绍Ubuntu下面的自启动脚本目录 1.2 Linux操作系统运行级别的概念 1.3关于操作系统自启脚本的启动顺序 1.4    Lin ...

  9. (转)CentOS 7 sytemctl 自定义服务开机启动

    CentOS 7 sytemctl 自定义服务开机启动 原文:http://blog.csdn.net/ithomer/article/details/51766319 CentOS 7继承了RHEL ...

随机推荐

  1. 配置本地无密码 SSH登录远程服务器

    下面这幅图简单来说就是你本地有一把钥匙,服务器也有一把钥匙,当登录的时候本地的钥匙与服务器的进行对比,通过算法的判定,监测是否具有权限的用户 第一步,在本地配置这把钥匙生成私钥与公钥: 打开.ssh目 ...

  2. 【ES】代码例子

    #!/usr/bin/env python #coding=utf-8 from elasticsearch import Elasticsearch from elasticsearch_dsl i ...

  3. 【linux】tcpdump抓包

    tcpdump -i eth0 host 192.168.11.22 -w ./target.cap 上面指令,抓取eth0中与192.168.11.22相关的流量,保存到target.cap中

  4. php单例模式的实例

    class Config1 {} class Config { * 必须先声明一个静态私有属性:用来保存当前类的实例 * 1. 为什么必须是静态的?因为静态成员属于类,并被类所有实例所共享 * 2. ...

  5. 完全背包记录路径poj1787 好题

    这题有点多重背包的感觉,但还是用完全背包解决,dp[j]表示凑到j元钱时的最大硬币数,pre[j]是前驱,used[j]是凑到j时第i种硬币的用量 △回溯答案时i-pre[i]就是硬币价值 #incl ...

  6. 《剑指offer》-链表找环入口

    题目描述 一个链表中包含环,请找出该链表的环的入口结点. 初步想法是每个节点做几个标记,表示是否被访问过,那么遍历链表的时候就知道哪个被访问到了.但是不会实现. 另一个直觉是判断链表有环的算法中出现过 ...

  7. textarea 标签换行及靠左

    上图可以实现文字文字靠左,换行直接回车就行,效果见下图

  8. struts2的文件上传和文件下载

    实现使用Struts2文件上传和文件下载: 注意点: (1)对应表单的file1和私有成员变量的名称必须一致 <input type="file" name="fi ...

  9. mySQL 增量备份方案

    1.在 /etc/my.cnf 下面设置开启bin-log 编辑 vim /etc/my.cnf [mysqld] binlog_format       = MIXED                ...

  10. will-change属性

    牛逼的 will-change属性 will-change属性可以提前通知浏览器我们要对元素做什么动画,这样浏览器可以提前准备合适的优化设置.这样可以避免对页面响应速度有重要影响的昂贵成本.元素可以更 ...