步骤一:系统环境要求
服务器系统配置好可用的软件源
步骤二:安装 cockpit
# yum -y install cockpit cockpit-dashaboard
(补充:cockpit 是管理单台主机的程序,cockpit-dashaboard 是管理多台主机的程序)
步骤三:启动 cockpit
# systemctl start cockpit
步骤四:登录 cockpit
使用浏览器登录:https://<服务器的 IP 地址>:9090
服务器系统配置好可用的软件源
# yum -y install cockpit cockpit-dashaboard
(补充:cockpit 是管理单台主机的程序,cockpit-dashaboard 是管理多台主机的程序)
# systemctl start cockpit
使用浏览器登录:https://<服务器的 IP 地址>:9090
# histroy
(注意:默认情况下 history 只会记录 1000 条历史命令)
# cat ~/.bash_history
# !23
# !h
开启 core dump 之后,如果出现了 C 语言程序的 crash,则会将 crash 的结果记录到一个文件里
# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31722
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 31722
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
# ulimit -c unlimited
# ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31722
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 31722
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
# sysctl -w kernel.core_pattern=/tmp/corefile/core-%e-%p
# last -n 10
或者:
# last -10
# last -10 -f /var/log/btmp
# last -10 -d
# last -10 -t 201910100000
# last | grep reboot | head -1
或者:
# last reboot | head -1
# last | grep -i shutdown | head -1
# last -x | grep runlevel
(补充:这里 -x 的作用是把系统运行等级的显示也显示出来,同时显示全系统 kernel 的变换)
# last -xF | egrep "reboot|shutdown|runlevel|system"
(
补充:
1) 这里 -x 的作用是把系统运行等级的显示也显示出来,同时显示全系统 kernel 的变换)
2) 这里 -F 的作用是加大显示结果
)
/var/log/messages
# grep -i <priority> /var/log/messages
序号 | 关键字 | 优先级 | 内容 |
1 | EMERG | 级别 0 | 紧急,系统本身已经无法再运行必须马上拯救 |
2 | ALERT | 级别 1 | 警报,系统出现了重大错误必须马上处理的情况 |
3 | CRIT | 级别 2 | 严重,系统出现了严重的情况 |
4 | ERROR | 级别 3 | 错误,系统出现了错误的情况 |
5 | WARNING | 级别 4 | 警告,系统出现了需要警告的情况 |
6 | NOTICE | 级别 5 | 注意,系统出现了需要注意的情况 |
7 | INFO | 级别 6 | 信息,系统出现了一些情况 |
8 | DEBUG | 级别 7 | 调试,系统出现了程序或服务调试的情况 |
(注意:优先级是按照从紧急到无所谓的顺序进行排列的)