1、我们安装一个httpd服务来测试一下 --now参数

yum install httpd

2、查看一下当前服务状态  可以看到服务没有启动 而且服务没有自启

[root@master1 ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:httpd(8)
man:apachectl(8)
[root@master1 ~]# [root@master1 ~]# systemctl is-enabled httpd
disabled
[root@master1 ~]#

3、用 --now参数启动一下

systemctl enable --now httpd

4、我们在看一下状态  可以看到服务启动了 同时  也开机自启了

[root@master1 conf]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2021-03-02 17:42:17 CST; 32s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 26736 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
Tasks: 6
Memory: 2.8M
CGroup: /system.slice/httpd.service
├─26736 /usr/sbin/httpd -DFOREGROUND
├─26737 /usr/sbin/httpd -DFOREGROUND
├─26738 /usr/sbin/httpd -DFOREGROUND
├─26739 /usr/sbin/httpd -DFOREGROUND
├─26740 /usr/sbin/httpd -DFOREGROUND
└─26741 /usr/sbin/httpd -DFOREGROUND Mar 02 17:42:17 master1 systemd[1]: Starting The Apache HTTP Server...
Mar 02 17:42:17 master1 systemd[1]: Started The Apache HTTP Server.
Mar 02 17:42:17 master1 httpd[26736]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1...s message
Hint: Some lines were ellipsized, use -l to show in full.
[root@master1 conf]# systemctl is-enabled httpd.service
enabled
[root@master1 conf]#

5、同理如果用 systemctl disable --now httpd.service  去关闭服务 他会关闭服务的同时 去掉开机自启

[root@master1 conf]# systemctl disable --now httpd.service
Removed symlink /etc/systemd/system/multi-user.target.wants/httpd.service.
[root@master1 conf]# systemctl is-enabled httpd.service
disabled
[root@master1 conf]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:httpd(8)
man:apachectl(8)

systemctl --now参数的更多相关文章

  1. linux systemctl 命令学习

    转载:http://www.cnblogs.com/sparkdev/p/8472711.html systemctl 命令有两大类功能: 控制 systemd 系统 管理系统上运行的服务 在介绍这些 ...

  2. linux systemctl 命令

    目录 预热 管理单个 unit 查看系统上的 unit 管理不同的操作环境(target unit) 检查 unit 之间的依赖性 相关的目录和文件 systemctl daemon-reload 子 ...

  3. linux的systemctl 命令用法 转

    目录 预热 管理单个 unit 查看系统上的 unit 管理不同的操作环境(target unit) 检查 unit 之间的依赖性 相关的目录和文件 systemctl daemon-reload 子 ...

  4. 操作系统systemctl命令

    目录 预热 管理单个 unit 查看系统上的 unit 管理不同的操作环境(target unit) 检查 unit 之间的依赖性 相关的目录和文件 systemctl daemon-reload 子 ...

  5. [转帖]linux中systemctl详细理解及常用命令

    linux中systemctl详细理解及常用命令 2019年06月28日 16:16:52 思维的深度 阅读数 30 https://blog.csdn.net/skh2015java/article ...

  6. linux中systemctl详细理解及常用命令

    linux中systemctl详细理解及常用命令 https://blog.csdn.net/skh2015java/article/details/94012643 一.systemctl理解 Li ...

  7. CentOS7进程管理systemd详解

      概述: 系统启动过程中,当内核启动完成,后加载根文件系统,后就绪的一些用户空间的服务的管理工作,就交由init进行启动和管理,在CentOS6之前的init的管理方式都类似,相关的内容我们在之前的 ...

  8. linux的ssh相关指令

    1.安装ssh apt-get install openssh-server 2.备份ssh的配置文件 sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_confi ...

  9. 认识系统服务 (daemons)

      daemon(守护进程:后台程序)与服务:   系统为了某些功能必须要提供一些服务 (不论是系统本身还是网络方面),这个服务就称为 service .但是 service 的提供总是需要程序的运作 ...

随机推荐

  1. js中判断数据类型的四种方法总结

    js中判断数据类型的四种方法 前言 在js中,我们经常需要判断数据的类型,那么哪些方法可以用来判断数据的类型呢?哪种方法判断数据类型最准确呢? 我们来一个个分析: 1.typeof typeof是一个 ...

  2. Linux进程理解与实践(五)细谈守护进程

    一. 守护进程及其特性      守护进程最重要的特性是后台运行.在这一点上DOS下的常驻内存程序TSR与之相似.其次,守护进程必须与其运行前的环境隔离开来.这些环境包括未关闭的文件描述符,控制终端, ...

  3. WPF 线程开启等待动画

    public static Dictionary<string, object> Dic = new Dictionary<string, object>();//定义一个字典 ...

  4. SSRF详解

    上一篇说了XSS的防御与绕过的思路,这次来谈一下SSRF的防御,绕过,利用及危害 0x01 前置知识梳理 前置知识涉及理解此漏洞的方方面面,所以这部分要说的内容比较多 SSRF(Server-Side ...

  5. mongoose报错:DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead

    参考:mongoose报错:DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead mo ...

  6. bootstrap导航条报错 Uncaught TypeError: Cannot convert object to primitive value

    原文: https://feiffy.cc/uncaught-typeerror-cannot-convert-object-to-primitive-value 最近发现我的博客页面移动端上下拉菜单 ...

  7. 分布式redis自增

    redis+springboot RedisUtil.java package com.meeno.chemical.common.redis; import java.util.Date; impo ...

  8. leaflet 的 marker 弹框 iframe 嵌套代码

    A页面 嵌套 B页面的代码 主要处理  leaflet 的 marker 的 popopen,     marker的点击的显示/隐藏 pop   会导致pop中的页面的内容,消失,不在页面中,导致b ...

  9. dataTemplate 使用

    App ----------------------------------------------------------------- <Application x:Class=" ...

  10. C#根据输入的字符串来创建类的实例

    abstract class Vehicle { public abstract void Drive(); } class Car : Vehicle { public override void ...