管理进程

image-20230304172746956

top

image-20230304172803322

操作系统服务管理 开启关闭永久关闭服务

系统中启动了哪些进程

如何查看后台进程

ps aux

建立死循环脚本

image-20230304172832973

vim /tmp/test.sh

chmod +x /tmp/test.sh 为脚本添加执行权限

/tmp/test.sh 运行 如果在后面添加 & 在后台运行

echo “xxx” > /dev/null

通过top命令查看并管理进程

top命令的快捷键 q 退出 k 杀进程

image-20230304172907056

systemctl list-unit-files 列出系统中所有进程的启动状态

disabled 开机不启动 enabled 开机启动

利用systemctl管理进程

systemctl start autofs 服务名称 – 启动服务

systemctl stop autofs 关闭服务

systemctl restart autofs 重启服务

systemctl disable autofs 开机不启动

为什么开机以后进入的是图形界面

运行模式 图形模式 多用户模式 救援模式

image-20230304172926727

systemctl get-default

systemctl set-default [启动级别]

总结:ps top 看进程

systemctl 管理有启动脚本的服务 (有配置文件)

centos 6 负责管理服务的进程 service start 服务名称

systemctl 负责管理进入的工作模式

centos 6 init进程管理 init 0 关机

systemctl poweroff

systemctl reboot