systemctl

linux的systemctl服务及其使用

烂漫一生 提交于 2020-01-29 03:52:53
一.systemd 系统初始化程序,系统开始的第一个进程,PID为1 二.systemctl命令 systemctl list-units ##列出当前系统服务的状态 systemctl list-unit-files ##列出服务的开机状态 systemctl status sshd ####看查指定服务的状态 systemctl stop sshd 关闭指定服务 systemctl start sshd ##开启指定服务 systemctl restart sshd ##重新启动服务 systemctl enable sshd ##设定指定服务开机开启,可以使用 systemctl disable sshd ##设定指定服务开机关闭,无法使用 systemctl reload sshd ##指定服务重新加栽配置 systemctl list-dependencies sshd 查看指定服务的依赖关系 systemctl mask sshd 冻结服务 systemctl unmask sshd 启动服务 systemctl set-default multi-user.target 开机不开启图形 systemctl set-default graphical. target 开机启动图形 setterm 文本界面设置颜色 systemctl set-default multi

“systemd”命令管理各类服务

£可爱£侵袭症+ 提交于 2020-01-28 15:29:12
一、centos7、red hat7 取消了运行级别的概念,用systemd代替了init中的运行级别概念。 二、用“ln”命令把“多用户,无图形”目标文件链接到/etc/systemd/system/目录中: # ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target 注:实现开机进入命令行界面。 三、使用“systemctl”命令管理服务 systemctl star 服务名.service 启动服务 systemctl restart 服务名.service 重启服务 systemctl stop 服务名.service 停止服务 systemctl reload 服务名.service 重新加载配置文件(不终止服务) systemctl status 服务名.service 查看服务状态 四、使用“systemctl”设置开机启动、不启动、查看各级别下服务启动状态 systemctl enable 服务名.service 开机自启服务 systemctl disable 服务名.service 开启不自启服务 systemctl is-enabled 服务名.service 查看特定服务是否开机自启 systemctl list-unit-files --type

RHEL7运行级别和服务

寵の児 提交于 2020-01-28 02:57:46
一 RHEL7运行级别 systemd使用“target”而不是运行级。默认情况下,有两个主要 target:multi-user.target:类似于运行级别3 graphical.target:类似于运行级5 1)查看当前默认目标,运行: systemctl get-default 2)设置一个默认目标,运行: systemctl set-default TARGET.target 3)查看默认运行级别 [root@ RHEL 7 ~]# systemctl get-default multi-user.target 4)设置默认的运行级别 [root@ RHEL 7 ~]# systemctl set-default multi-user.target rm '/etc/systemd/system/default.target' ln -s '/usr/lib/systemd/system/multi-user.target' '/etc/systemd/system/default.target' 5)切换运行级别 [root@ RHEL 7 ~]# systemctl isolate multi-user.target 二 RHEL7服务 systemd 的主要的命令行工具是systemctl 注意:servic和 chkconfig 在引进systemd 照常可以使用

Nginx 之 Rewrite和具体场景

纵饮孤独 提交于 2020-01-27 03:02:02
文章目录 一、环境准备 二、Rewrite 介绍 2.1、Rewrite跳转场景 2.2、Rewrite 实用场景 2.3、常用的正则表达式元字符 2.4、Rewrite 命令 2.5、location 分类 2.6、location 优先级 三、具体场景 3.1、场景一:基于域名的跳转 3.2、场景二:基于客户端IP地址访问跳转 3.3、场景三:基于旧、新域名跳转并加目录 3.4、场景四:基于参数匹配跳转 3.5、场景五:基于目录下所有php文件跳转 3.6、场景六:基于最普通 url 请求的跳转 一、环境准备 一台nginx服务器提供 www.test.com 的网页。 1、安装rpm源 rpm - Uvh http : / / nginx . org / packages / centos / 7 / noarch / RPMS / nginx - release - centos - 7 - 0. el7 . ngx . noarch . rpm 2、直接用yum安装nginx和bind yum install nginx bind - y 3、DNS域名解析 vim / etc / named . conf vim / etc / named . rfc1912 . zones //复制修改 zone "test.com" IN { type master ; file

linux命令s---systemctl

白昼怎懂夜的黑 提交于 2020-01-26 19:41:18
1、查看防火墙: systemctl status firewalld。 2、临时操作: systemctl start firewalld systemctl stop firewalld 3、永久生效,但是需要重启: systemctl enable firewalld systemctl disable firewalld 4、systemd有重启次数限制,如下命令可以复位重启次数 /bin/systemctl reset-failed ceph-mon@`hostname`.service 来源: CSDN 作者: 学无止境966 链接: https://blog.csdn.net/qq_23929673/article/details/94059561

linux入门(三)Systemd指令、防火墙

走远了吗. 提交于 2020-01-25 12:26:35
Systemd指令 介绍: 是为系统的启动和管理提供一套完整的解决方案。 systemd不是一个命令,而是一组命令,涉及到系统管理的方方面面。 指令 查看版本信息 systemctl --version systemctl 是systemd的主命令,用于管理系统 重启系统 systemctl reboot 关闭系统,切断电源 systemctl poweroff cpu停止工作 systemctl halt 暂停系统 systemclt suspend 让系统进入冬眠状态 systemclt hibernate 让系统进入交互式休眠 systemctl hybrid-sleep 启动进入救援状态 systemctl critical-chain atd.service systemd-analyze 用于查看启动耗时 查看启动耗时 systemd-analyze 查看每个服务的启动耗时 systemd-analyze blame 显示瀑布状的启动过程流 systemd-analyze critical-chain 显示指定服务的启动流 systemd-analyze critical-chain atd.service hostnamectl 用于查看当前主机的信息 查看主机信息 hostnamectl 设置主机名 hostnamectl set-hostname 主机名

centons7安装 ambari准备工作

冷暖自知 提交于 2020-01-25 10:48:58
安装java,maven 安装过程略,环境变量配置 export JAVA_HOME = /home/ambari/tools/jdk1.8.0_221 export CLASSPATH = .: $JAVA_HOME /jre/lib: $JAVA_HOME /lib: $JAVA_HOME /lib/tools.jar export MAVEN_HOME = /home/ambari/tools/apache-maven-3.6.3 export PATH = $PATH : $HOME /.local/bin: $HOME /bin: $JAVA_HOME /bin: $MAVEN_HOME /bin 修改主机名,主机映射关系 修改主机名 vi /etc/hostname kylin60 集群主机映射配置 vi /etc/hosts 192.168.4.60 kylin60 192.168.4.61 kylin61 192.168.4.62 kylin62 关闭防火墙 sudo systemctl stop firewalld sudo systemctl disable firewalld sudo systemctl status firewalld 关闭selinux vi /etc/sysconfig/selinux SELINUX=disabled 机器重启

CentOS7关闭防火墙方法

穿精又带淫゛_ 提交于 2020-01-25 10:07:58
在之前的版本中关闭防火墙等服务的命令是 service iptables stop /etc/init.d/iptables stop 在RHEL7中,其实没有这个服务 [root@rhel7 ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.0 (Maipo) [root@rhel7 ~]# service iptables stop Redirecting to /bin/systemctl stop iptables.service [root@rhel7 ~]# /etc/init.d/iptables stop -bash: /etc/init.d/iptables: No such file or directory 原来在RHEL7开始,使用systemctl工具来管理服务程序,包括了service和chkconfig [root@rhel7 ~]# systemctl list-unit-files|grep enabled cups.path enabled abrt-ccpp.service enabled abrt-oops.service enabled abrt-vmcore.service enabled abrt-xorg.service enabled

CentOS7关闭防火墙方法

限于喜欢 提交于 2020-01-25 10:07:12
在之前的版本中关闭防火墙等服务的命令是 service iptables stop /etc/init.d/iptables stop 在RHEL7中,其实没有这个服务 [root@rhel7 ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.0 (Maipo) [root@rhel7 ~]# service iptables stop Redirecting to /bin/systemctl stop iptables.service [root@rhel7 ~]# /etc/init.d/iptables stop -bash: /etc/init.d/iptables: No such file or directory 原来在RHEL7开始,使用systemctl工具来管理服务程序,包括了service和chkconfig [root@rhel7 ~]# systemctl list-unit-files|grep enabled cups.path enabled abrt-ccpp.service enabled abrt-oops.service enabled abrt-vmcore.service enabled abrt-xorg.service enabled

CentOS7关闭防火墙方法

与世无争的帅哥 提交于 2020-01-25 10:06:38
在之前的版本中关闭防火墙等服务的命令是 service iptables stop /etc/init.d/iptables stop 在RHEL7中,其实没有这个服务 [root@rhel7 ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.0 (Maipo) [root@rhel7 ~]# service iptables stop Redirecting to /bin/systemctl stop iptables.service [root@rhel7 ~]# /etc/init.d/iptables stop -bash: /etc/init.d/iptables: No such file or directory 原来在RHEL7开始,使用systemctl工具来管理服务程序,包括了service和chkconfig [root@rhel7 ~]# systemctl list-unit-files|grep enabled cups.path enabled abrt-ccpp.service enabled abrt-oops.service enabled abrt-vmcore.service enabled abrt-xorg.service enabled