Linux系统服务管理
服务命令比较
操作 | Linux 6 | Linux7 |
服务开机自动启动 | chkconfig --level 35 iptables on | systemctl enable firewalld.service |
服务器开机不自动启动 | chkconfig --level 35 iptables off | systemctl disable firewalld.service |
加入自定义服务 | chkconfig --add aaa | systemctl load aaa.service |
删除服务 | chkconfig --del aaa | 停止服务,删除相应的配置文件 |
显示所有已经启动的服务 | chkconfig -- list | systemctl list-unis --type=service |
启动服务 | service iptables start | systemctl start firewalld.service |
停止服务 | service iptables stop | systemctl stop firewalld.service |
服务状态 | service iptables status | systemctl status firewalld.service |
重启服务 | service iptables restart | systemctl restart firewalld.service |
Linux 6
[root@mysql57 ~]# service iptables status
iptables: Firewall is not running.[root@mysql57 ~]# service iptables start
iptables: Applying firewall rules: [ OK ]
[root@mysql57 ~]# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
[root@mysql57 ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
[root@mysql57 ~]# service iptables status
iptables: Firewall is not running.[root@mysql57 ~]# chkconfig --list | more
NetworkManager 0:off 1:off 2:off 3:off 4:off 5:off 6:off
abrt-ccpp 0:off 1:off 2:off 3:on 4:off 5:on 6:off
abrtd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
acpid 0:off 1:off 2:on 3:on 4:on 5:on 6:off
atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
autofs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
blk-availability 0:off 1:on 2:on 3:on 4:on 5:on 6:off
bluetooth 0:off 1:off 2:off 3:on 4:on 5:on 6:off
certmonger 0:off 1:off 2:off 3:on 4:on 5:on 6:off
cpuspeed 0:off 1:on 2:on 3:on 4:on 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
cups 0:off 1:off 2:on 3:on 4:on 5:on 6:off
dnsmasq 0:off 1:off 2:off 3:off 4:off 5:off 6:off
firstboot 0:off 1:off 2:off 3:off 4:off 5:off 6:off
haldaemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off
htcacheclean 0:off 1:off 2:off 3:off 4:off 5:off 6:off
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
irqbalance 0:off 1:off 2:off 3:on 4:on 5:on 6:off
kdump 0:off 1:off 2:off 3:off 4:off 5:off 6:off
lvm2-monitor 0:off 1:on 2:on 3:on 4:on 5:on 6:off
mdmonitor 0:off 1:off 2:on 3:on 4:on 5:on 6:off
messagebus 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
nfs 0:off 1:off 2:off 3:off 4:off 5:off 6:off
nfslock 0:off 1:off 2:off 3:on 4:on 5:on 6:off
ntpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
ntpdate 0:off 1:off 2:off 3:off 4:off 5:off 6:off
oddjobd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
portreserve 0:off 1:off 2:on 3:on 4:on 5:on 6:off
postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off
psacct 0:off 1:off 2:off 3:off 4:off 5:off 6:off
quota_nld 0:off 1:off 2:off 3:off 4:off 5:off 6:off35启动级别关闭自启动
[root@mysql57 ~]# chkconfig --level 35 iptables off[root@mysql57 ~]# ls /etc/init.d/
abrt-ccpp cups irqbalance nfslock rngd spice-vdagentd
abrtd dnsmasq kdump ntpd rpcbind sshd
abrt-oops firstboot killall ntpdate rpcgssd sssd
acpid functions lvm2-lvmetad oddjobd rpcidmapd sysstat
atd haldaemon lvm2-monitor ohasd rpcsvcgssd udev-post
auditd halt mdmonitor portreserve rsyslog wdaemon
autofs htcacheclean messagebus postfix sandbox winbind
blk-availability httpd netconsole psacct saslauthd wpa_supplicant
bluetooth init.ohasd netfs quota_nld single ypbind
certmonger init.tfa network rdisc smartd
cpuspeed ip6tables NetworkManager restorecond snmpd
crond iptables nfs rhnsd snmptrapd
Linux 7
[root@mysql57 ~]# cd /etc/systemd/system/
basic.target.wants/
bluetooth.target.wants/
default.target.wants/
dev-virtio\x2dports-org.qemu.guest_agent.0.device.wants/
getty.target.wants/
graphical.target.wants/
local-fs.target.wants/
multi-user.target.wants/
network-online.target.wants/
printer.target.wants/
remote-fs.target.wants/
sockets.target.wants/
sysinit.target.wants/
systemd-remount-fs.service.wants/
system-update.target.wants/
timers.target.wants/
vmtoolsd.service.requires/
[root@mysql57 ~]# cd /etc/systemd/system/
[root@mysql57 system]# ls
basic.target.wants
bluetooth.target.wants
dbus-org.bluez.service
dbus-org.fedoraproject.FirewallD1.service
dbus-org.freedesktop.Avahi.service
dbus-org.freedesktop.ModemManager1.service
dbus-org.freedesktop.nm-dispatcher.service
default.target
default.target.wants
dev-virtio\x2dports-org.qemu.guest_agent.0.device.wants
display-manager.service
getty.target.wants
graphical.target.wants
local-fs.target.wants
multi-user.target.wants
network-online.target.wants
printer.target.wants
remote-fs.target.wants
sockets.target.wants
sysinit.target.wants
systemd-remount-fs.service.wants
system-update.target.wants
timers.target.wants
vmtoolsd.service.requires[root@mysql57 system]# cd multi-user.target.wants/
[root@mysql57 multi-user.target.wants]# ls
abrt-ccpp.service initial-setup-reconfiguration.service remote-fs.target
abrtd.service irqbalance.service rhel-configure.service
abrt-oops.service ksm.service rngd.service
abrt-vmcore.service ksmtuned.service rpcbind.service
abrt-xorg.service libstoragemgmt.service rsyslog.service
atd.service libvirtd.service smartd.service
auditd.service mcelog.service sshd.service
avahi-daemon.service mdmonitor.service sysstat.service
brandbot.path ModemManager.service tuned.service
crond.service NetworkManager.service vdo.service
cups.path nfs-client.target vmtoolsd.service
cups.service oracleasm.service
firewalld.service postfix.service[root@mysql57 multi-user.target.wants]# cd ..
[root@mysql57 system]# find ./ -name fire*
./multi-user.target.wants/firewalld.service
[root@mysql57 system]# cd multi-user.target.wants/[root@mysql57 multi-user.target.wants]# cd /usr/lib/systemd/
[root@mysql57 systemd]# ls
catalog systemd-coredump systemd-shutdown
import-pubring.gpg systemd-cryptsetup systemd-shutdownd
ntp-units.d systemd-fsck systemd-sleep
ol-consolebaud systemd-hibernate-resume systemd-socket-proxyd
rhel-autorelabel systemd-hostnamed systemd-sysctl
rhel-configure systemd-importd systemd-sysv-install
rhel-dmesg systemd-initctl systemd-timedated
rhel-dmraid-activation systemd-journald systemd-udevd
rhel-domainname systemd-localed systemd-update-done
rhel-import-state systemd-logind systemd-update-utmp
rhel-loadmodules systemd-machined systemd-user-sessions
rhel-readonly systemd-machine-id-commit systemd-vconsole-setup
scripts systemd-modules-load system-generators
system systemd-pstore system-preset
systemd systemd-pull system-shutdown
systemd-ac-power systemd-quotacheck system-sleep
systemd-activate systemd-random-seed user
systemd-backlight systemd-readahead user-generators
systemd-binfmt systemd-remount-fs user-preset
systemd-bootchart systemd-reply-password
systemd-cgroups-agent systemd-rfkill[root@mysql57 systemd]# systemctl status firewalld.service
实际加载的/usr/lib/systemd/system/firewalld.service
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)Active: active (running) since Tue 2022-08-23 13:05:37 CST; 12min agoDocs: man:firewalld(1)Main PID: 1026 (firewalld)Tasks: 2CGroup: /system.slice/firewalld.service└─1026 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopidAug 23 13:05:36 mysql57.example.com systemd[1]: Starting firewalld - dynamic firewal.....
Aug 23 13:05:37 mysql57.example.com systemd[1]: Started firewalld - dynamic firewall...n.
Aug 23 13:05:37 mysql57.example.com firewalld[1026]: WARNING: AllowZoneDrifting is en....
Hint: Some lines were ellipsized, use -l to show in full.[root@mysql57 system]# ls | grep firewalld
firewalld.service
[root@mysql57 system]# pwd
/usr/lib/systemd/system关闭防火墙
[root@mysql57 system]# systemctl stop firewalld.service disable
[root@mysql57 system]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.启动防护墙,开机不启动因为是disabled
[root@mysql57 system]# systemctl start firewalld.service
[root@mysql57 system]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemonLoaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)Active: active (running) since Tue 2022-08-23 15:14:24 CST; 2s agoDocs: man:firewalld(1)Main PID: 4701 (firewalld)Tasks: 4CGroup: /system.slice/firewalld.service├─4701 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid├─4729 /usr/sbin/modprobe nf_conntrack├─4730 sh -c /usr/sbin/modprobe --ignore-install nf_conntrack && /usr/sb...└─4731 /usr/sbin/modprobe --ignore-install nf_conntrackAug 23 15:14:19 mysql57.example.com systemd[1]: Starting firewalld - dynamic firewal.....
Aug 23 15:14:24 mysql57.example.com systemd[1]: Started firewalld - dynamic firewall...n.
Aug 23 15:14:25 mysql57.example.com firewalld[4701]: WARNING: AllowZoneDrifting is en....
Hint: Some lines were ellipsized, use -l to show in full.
相关文章:
Linux系统服务管理
服务命令比较 操作 Linux 6 Linux7 服务开机自动启动 chkconfig --level 35 iptables on systemctl enable firewalld.service 服务器开机不自动启动 chkconfig --level 35 iptables off systemctl disable firewalld.service 加入自定义服务 chkconfig --add aaa s…...

C#之控制台版本得贪吃蛇
贪吃蛇小时候大家都玩过,具体步骤如下: 1.给游戏制造一个有限得空间。 2.生成墙壁,小蛇碰撞到墙壁或者咬到自己的尾巴,游戏结束。 3.生成随机的食物。 4.吃掉食物,增加自身的体长,并生成新的食物。 具体代码如下&…...

ffplay数据结构分析(一)
本文为相关课程的学习记录,相关分析均来源于课程的讲解,主要学习音视频相关的操作,对字幕的处理不做分析 下面我们对ffplay的相关数据结构进行分析,本章主要是对PacketQueue的讲解 struct MyAVPacketList和PacketQueue队列 ffp…...

JavaWeb学习|JSP相关内容
1.什么是JSP Java Server Pages: Java服务器端页面,也和Servlet一样,用于动态Web技术! 最大的特点: 。写JSP就像在写HTML 。区别: 。HTML只给用户提供静态的数据 。JSP页面中可以嵌入JAVA代码,为用户提供动态数据 JSP最终也会被转换成为一…...

Springboot后端通过路径映射获取本机图片资源
项目场景: 项目中对图片的处理与查看是必不可少的,本文将讲解如何通过项目路径来获取到本机电脑的图片资源 如图所示,在我的本机D盘的图片测试文件夹(文件夹名字不要有中文)下有一些图片, 我们要在浏览器上访问到这些图片&#…...

【IDEA + Spark 3.4.1 + sbt 1.9.3 + Spark MLlib 构建鸢尾花决策树分类预测模型】
决策树进行鸢尾花分类的案例 背景说明: 通过IDEA Spark 3.4.1 sbt 1.9.3 Spark MLlib 构建鸢尾花决策树分类预测模型,这是一个分类模型案例,通过该案例,可以快速了解Spark MLlib分类预测模型的使用方法。 依赖 ThisBuild /…...

亚马逊 EC2服务器下部署java环境
1. jdk 1.8 安装 1.1 下载jdk包 官网 Java Downloads | Oracle tar.gz 包 下载下来 1.2 本地连接 服务器 我用的是亚马逊的ec2 系统是 ubuntu 的 ssh工具是 Mobaxterm , 公有dns 创建实例时的秘钥 链接 Mobaxterm 因为使用的 ubuntu 所以登录的 名称 就是 ubuntu 然后 …...

CTF流量题解http1.pcapng
使用Wireshark工具打开流量文件http1.pcapng,如下图所示。 在过滤检索栏输入http,wireshark自动进行过滤。...
若依vue前端有全局用户信息变量吗
"若依"是一个基于SpringBoot和Vue的前后端分离的开源项目。在前端Vue部分,全局用户信息通常保存在Vuex中,Vuex是Vue.js的状态管理模式。它提供了一个集中式存储来管理所有组件的状态,并以相应的规则保证状态以一种可预测的方式发生…...

什么是Milvus
原文出处:https://www.yii666.com/blog/393941.html 什么是Milvus Milvus 是一款云原生向量数据库,它具备高可用、高性能、易拓展的特点,用于海量向量数据的实时召回。 Milvus 基于 FAISS、Annoy、HNSW 等向量搜索库构建,核心是…...

如何快速实现三菱FX3U程序的无线下载?
1.系统概述 三菱PLC FX3u可以使用专用下载线通过计算机串口下载程序,同样也可以使用自制下载线缆,连接无线模块 DTD435M进行远程无线下载程序,计算机端采用RS232或者RS485 将计算机端与无线模块连接,PLC端同样使用RS232转RS485将…...

Flink源码之RPC
Flink是一个典型的Master/Slave分布式实时处理系统,分布式系统组件之间必然涉及通信,也即RPC,以下图展示Flink组件之间的关系: RPCGateWay 一般RPC框架可根据用户业务类生成客户端和服务器端通信底层代码,此时只需定…...

【LeetCode 75】第二十四题(2390)从字符串中移除星号
目录 题目: 示例: 分析: 代码运行结果: 题目: 示例: 分析: 题目给我们一个字符串,然后字符串中包含星号*,要求每个星号消除一个从星号左边起最近的一个字符…...

通向架构师的道路之weblogic的集群与配置
一、Weblogic的集群 还记得我们在第五天教程中讲到的关于Tomcat的集群吗? 两个tomcat做node即tomcat1, tomcat2,使用Apache HttpServer做请求派发。 现在看看WebLogic的集群吧,其实也差不多。 区别在于: Tomcat的集群的实现为两个物理上…...

SpringBoot 项目创建与运行
一、Spring Boot 1、什么是Spring Boot?为什么要学 Spring Boot Spring 的诞生是为了简化 Java 程序的开发的,而 Spring Boot 的诞生是为了简化 Spring 程序开发的。 Spring Boot 翻译一下就是 Spring 脚手架 盖房子的这个架子就是脚手架,…...

FOHEART H1数据手套:连接虚拟与现实,塑造智能交互新未来
在全新交互时代背景中,数据手套无疑是一种重要的科技产物。它不仅彻底改变了我们与虚拟世界的互动方式,更为我们提供了一种全新、更为直观的交互形式。 FOHEART H1数据手套结合了虚拟现实、手势识别等高新技术,用先进的传感技术和精准的数据…...
MyBatis学习笔记3
日志 1.日志工厂 如果一个数据库的操作,出现了异常,我们需要排错。日志就是最好的工具。 日志工厂:SLF4JLOG4J(掌握)LOG4J2JDK_LOGGINGCOMMONS_LOGGINGSTDOUT_LOGGING(掌握)NO_LOGGING 2.分页 减少数据…...
ES6学习-Symbol
Symbol 数据类型Symbol,表示独一无二的值。 对象的属性名可有两种类型,一种是原来的字符串,另一种是新增的 Symbol 类型 可以保证不与其他属性名产生冲突。 let s1 Symbol() let s2 Symbol() console.log(s1, s2, s1 s2)//Symbol() Sy…...

【Redis】使用Docker镜像配置集群时的Operation timed out问题
不知道有没有小伙伴跟我一样是使用的Docker镜像进行Redis集群案例模拟的(三台虚拟机确实带不动 ),然后我遇到了一个问题:Could not connect to Redis at 172.17.0.2:6379: Operation timed out 172.17.0.2是我其中一个Redis实例的…...

Java 生产初学常用注解
目录 0. 基础语法逻辑运算符继承抛出异常获取数据方式泛型 1. 接收前端数据(controller)mybatis1. QueryWrapper获取和赋值 2. service 层注解 3. Dao 层(与数据库交互)3.1 mybatis-plus中BaseMapper 4. ELK框架es配置sql参数logs…...
synchronized 学习
学习源: https://www.bilibili.com/video/BV1aJ411V763?spm_id_from333.788.videopod.episodes&vd_source32e1c41a9370911ab06d12fbc36c4ebc 1.应用场景 不超卖,也要考虑性能问题(场景) 2.常见面试问题: sync出…...
模型参数、模型存储精度、参数与显存
模型参数量衡量单位 M:百万(Million) B:十亿(Billion) 1 B 1000 M 1B 1000M 1B1000M 参数存储精度 模型参数是固定的,但是一个参数所表示多少字节不一定,需要看这个参数以什么…...

【SQL学习笔记1】增删改查+多表连接全解析(内附SQL免费在线练习工具)
可以使用Sqliteviz这个网站免费编写sql语句,它能够让用户直接在浏览器内练习SQL的语法,不需要安装任何软件。 链接如下: sqliteviz 注意: 在转写SQL语法时,关键字之间有一个特定的顺序,这个顺序会影响到…...

DIY|Mac 搭建 ESP-IDF 开发环境及编译小智 AI
前一阵子在百度 AI 开发者大会上,看到基于小智 AI DIY 玩具的演示,感觉有点意思,想着自己也来试试。 如果只是想烧录现成的固件,乐鑫官方除了提供了 Windows 版本的 Flash 下载工具 之外,还提供了基于网页版的 ESP LA…...

力扣热题100 k个一组反转链表题解
题目: 代码: func reverseKGroup(head *ListNode, k int) *ListNode {cur : headfor i : 0; i < k; i {if cur nil {return head}cur cur.Next}newHead : reverse(head, cur)head.Next reverseKGroup(cur, k)return newHead }func reverse(start, end *ListNode) *ListN…...

并发编程 - go版
1.并发编程基础概念 进程和线程 A. 进程是程序在操作系统中的一次执行过程,系统进行资源分配和调度的一个独立单位。B. 线程是进程的一个执行实体,是CPU调度和分派的基本单位,它是比进程更小的能独立运行的基本单位。C.一个进程可以创建和撤销多个线程;同一个进程中…...

Golang——6、指针和结构体
指针和结构体 1、指针1.1、指针地址和指针类型1.2、指针取值1.3、new和make 2、结构体2.1、type关键字的使用2.2、结构体的定义和初始化2.3、结构体方法和接收者2.4、给任意类型添加方法2.5、结构体的匿名字段2.6、嵌套结构体2.7、嵌套匿名结构体2.8、结构体的继承 3、结构体与…...

【若依】框架项目部署笔记
参考【SpringBoot】【Vue】项目部署_no main manifest attribute, in springboot-0.0.1-sn-CSDN博客 多一个redis安装 准备工作: 压缩包下载:http://download.redis.io/releases 1. 上传压缩包,并进入压缩包所在目录,解压到目标…...

LeetCode 2894.分类求和并作差
目录 题目: 题目描述: 题目链接: 思路: 思路一详解(遍历 判断): 思路二详解(数学规律/公式): 代码: Java思路一(遍历 判断&a…...
stm32—ADC和DAC
ADC和DAC 在嵌入式系统中,微控制器经常需要与现实世界的模拟信号进行交互。STM32微控制器内置了模拟数字转换器(ADC)和数字模拟转换器(DAC),它们是实现这种交互的关键模块。 1. 模拟数字转换器(…...