Linux-常用运维命令
2023-07-03
查看服务器当前状态
查看ip
ip ad [show] [具体要查看的,etho]
# 如果有虚拟ip(vip)绑定,则也可以通过此命令查看到
ipconfig
查看服务状态
systemctl status 服务名
[cindy@iZbp15qc4wmx335c268l5mZ ~]$ systemctl status mysqld
● mysqld.service - LSB: start and stop MySQL
Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
Active: active (exited) since Mon 2022-11-07 20:24:30 CST; 7 months 24 days ago
Docs: man:systemd-sysv-generator(8)
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailab
le.
# 除了查看,还可以用systemctl来修改服务状态
systemctl start service_name
systemctl stop service_name
systemctl restart service_name
systemctl disable service_name # 取消开机自启动
服务状态包括:
- loaded ##系统服务已经初始化完成,加载过配置
- active(running) ##正有一个或多个程序正在系统中执行, vsftpd就是这种模式
- atcive(exited) ##僅執行一次就正常結束的服務, 目前並沒有任何程序在系統中執行
- atcive(waiting) ##正在執行當中,不過還再等待其他的事件才能继续处理
- inactive ##服务关闭
- enbaled ##服务开机启动
- disabled ##服务开机不自启
- static ##服务开机启动项不可被管理
- failed ##系统配置错误