检查正在运行的服务的推荐方法是什么?

syn*_*ack 10 debian centos services sles

我经常接触各种 GNU/Linux 系统,包括 CentOS、SLES 和 Debian。

我想知道:检查这些系统中所有正在运行的服务的推荐方法是什么?

我知道的service --status-allchkconfig,但他们并不总是可用。

请指教。

Rah*_*til 7

我想知道:检查这些系统中所有正在运行的服务的推荐方法是什么?

由于您知道chkconfig, service, 并且可能是ntsysv, rcconf,

但是您可以使用以下几乎适用于所有风格的命令进行检查

ls -1 /etc/rc$(runlevel| cut -d" " -f2).d/S*
Run Code Online (Sandbox Code Playgroud)

什么是 S*?

传统的 init 风格制作以 S 或 K 开头的符号链接。那些带有 S 的符号表示“开始”,并且在进入该运行级别时使用“开始”参数运行它们。那些带有 K 的意思是“杀死”,这些服务在进入该运行级别时使用“停止”参数运行

完整细节:

ls -1 /etc/rc$(runlevel| cut -d" " -f2).d/S* | \
awk -F'[0-9][0-9]' '{print "Startup :-> " $2}'
Run Code Online (Sandbox Code Playgroud)

输出:

Startup :-> bind9
Startup :-> apt-cacher-ng
Startup :-> slapd
Startup :-> cron
Startup :-> dmesg
Startup :-> inetutils-inetd
Startup :-> ssh
Startup :-> dns-clean
Startup :-> sudo
Startup :-> apache2
Startup :-> grub-common
Startup :-> ondemand
Startup :-> rc.local
Run Code Online (Sandbox Code Playgroud)