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