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)

最新文章

  1. Maven Archetype
  2. Oracle 中 decode 函数用法(转)
  3. TL-WR703 USB不稳定/当前的总结
  4. ios播放声音中断后台音乐的问题
  5. Web应用的组件化(二)
  6. SimpleDateFormat线程不安全问题处理
  7. LINQ to SQL 基础
  8. 编写可维护的javascript代码--- 2015.11.22(注释)
  9. wordpress在window下完美实现301重定向的方法
  10. 升级iOS8系统后,保险箱Pro、私人保险箱、私密相冊打开就闪退的官方解决方式
  11. 在word表格里打勾和打叉
  12. 【转】Matlab中的括号()[] {}
  13. Package与Activity简介
  14. mysql 中Varchar 与char的区别
  15. m2eclipse(maven插件)报错解决
  16. 为什么要先装IIS后装.Net Framework?
  17. openstack安装指南和在centos7上的安装指南
  18. LaTeX文章结构
  19. [hadoop读书笔记]前言
  20. hadoop 、hive 的一些使用经验。

热门文章

  1. 时间转换 BASIC-14
  2. 【Mongodb】数据库备份与还原
  3. MongoDB-03-分片集群
  4. Python语言系列-10-数据库
  5. application.properties 和 pom.xml
  6. 006 媒体独立接口(MII,Meida Independent Interface)
  7. selenium处理:您的连接不是私密连接的网站(https ssl 证书)
  8. mongodb中时间跟实际时间相差8小时----时区问题
  9. 【springboot】 junit 测试
  10. 09.SpringMVC之类型转换