systemctl命令

systemctl

systemctl命令是系统服务管理器指令,它实际上将 service 和 chkconfig 这两个命令组合到一起。

任务 旧指令 新指令
使某服务自动启动 chkconfig –level 3 httpd on systemctl enable httpd.service
使某服务不自动启动 chkconfig –level 3 httpd off systemctl disable httpd.service
检查服务状态 service httpd status systemctl status httpd.service (服务详细信息) systemctl is-active httpd.service (仅显示是否 Active)
显示所有已启动的服务 chkconfig –list systemctl list-units —type=service
启动某服务 service httpd start systemctl start httpd.service
停止某服务 service httpd stop systemctl stop httpd.service
重启某服务 service httpd restart systemctl restart httpd.service

实例

1.启动nfs服务

systemctl start nfs-server.service

2.设置开机自启动

systemctl enable nfs-server.service

3.停止开机自启动

systemctl disable nfs-server.service

4.查看服务当前状态

systemctl status nfs-server.service

5.重新启动某服务

systemctl restart nfs-server.service

6.查看所有已启动的服务

systemctl list -units --type=service

开启防火墙22端口

iptables -I INPUT -p tcp --dport 22 -j accept

如果仍然有问题,就可能是SELinux导致的

关闭SElinux:

修改/etc/selinux/config文件中的SELINUX=””为disabled,然后重启。

彻底关闭防火墙:

sudo systemctl status firewalld.service
sudo systemctl stop firewalld.service          
sudo systemctl disable firewalld.service
原文地址:http://man.linuxde.net/systemctl

本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/96942

(2)
小孜然小孜然
上一篇 2018-04-23 22:59
下一篇 2018-04-24 10:54

相关推荐

  • linux学习4

    linux学习4

    Linux笔记 2018-07-14
  • 计算机基础与linux基础

    描述计算机的组成及功能 按系列罗列linux的发行版,并描述不同发行版之间的联系与区别 描述linux的哲学思想,并按照自己的理解对其解释性描述 说明Linux系统上命令的使用格式;详细介绍ifconfig.echo,tty,startx,export,pwd,history,shutdown,poweroff,reboot,hwclock,date命令的使…

    Linux笔记 2018-06-19
  • sed

    用法: sed  [选项]… ‘script’ inputfile 其中script是脚本基于sed语法的脚本                 inputfile文件内容 常用选项 -n   :不输出模式空间内容到屏幕,即不自动打印 -e   :多点编辑 -f    :   /PATH/SCRIPT_FILE:从指定文件中…

    Linux笔记 2018-04-14
  • 带你认识Linux中的通配符

    所谓的通配是指:显示以指定条件的文件,英文名为glob。通配符是一种特殊语句,用来模糊搜索文件。当查找文件夹时,可以使用它来代替一个或多个真正字符它使得文件管理更加快速,便捷,大大提升了工作效率。

    2018-04-01
  • 使用ansible完成keepalived高可用Nginx的配置;

    编写ansible role,完成keepalived高可用Nginx的配置;

    2018-07-12
  • N31第二周

    1、Linux上的文件管理类命令都有哪些,其常用的方法及其相关示例演示: mkdir mkdir:创建目录 格式:mkdir [OPTION]… DIRECTORY… -m –mode=模式,设定权限<模式> (类似 chmod)  -p 此时若路径中的某些目录尚不存在,加上此选项后,系统将自动建立好那些尚不存在的目录, 即一次可以建立多…

    2018-06-26