符号在哪里以及它们表示什么?

符号在哪里以及它们表示什么?

我使用命令作为service --status-all

oot@frank-Jai:~#  service --status-all 
 [ ? ]  acpi-support
 [ ? ]  acpid
 [ ? ]  alsa-restore
 [ ? ]  alsa-store
 [ ? ]  anacron
 [ + ]  apache2
 [ + ]  apparmor
 [ ? ]  apport
 [ ? ]  avahi-cups-reload
 [ ? ]  avahi-daemon
 [ ? ]  binfmt-support
 [ ? ]  bluetooth
 [ - ]  bootlogd
 [ - ]  brltty
 [ ? ]  console-font
 [ ? ]  console-setup
 [ ? ]  cron
 [ ? ]  cups
 [ ? ]  cups-browsed
 [ ? ]  dbus
 [ ? ]  dmesg
 [ ? ]  dns-clean
 [ - ]  dnsmasq
 [ ? ]  failsafe-x
 [ ? ]  friendly-recovery
 [ - ]  grub-common
 [ - ]  hostapd
 [ ? ]  hostname
 [ ? ]  hwclock
 [ ? ]  hwclock-save
 [ ? ]  irqbalance
 [ ? ]  kdm
 [ - ]  kerneloops
 [ ? ]  killprocs
 [ ? ]  kmod
 [ ? ]  lightdm
 [ ? ]  modemmanager
 [ ? ]  mysql
 [ ? ]  network-interface
 [ ? ]  network-interface-container
 [ ? ]  network-interface-security
 [ ? ]  network-manager
 [ ? ]  networking
 [ ? ]  networking.dpkg-new
 [ ? ]  ondemand
 [ ? ]  plymouth
 [ ? ]  plymouth-log
 [ ? ]  plymouth-ready
 [ ? ]  plymouth-splash
 [ ? ]  plymouth-stop
 [ ? ]  plymouth-upstart-bridge
 [ ? ]  powernap
 [ ? ]  pppd-dns
 [ ? ]  procps
 [ ? ]  pulseaudio
 [ ? ]  rc.local
 [ ? ]  resolvconf
 [ ? ]  rfkill-restore
 [ ? ]  rfkill-store
 [ - ]  rsync
 [ ? ]  rsyslog
 [ + ]  saned
 [ ? ]  sendsigs
 [ ? ]  setvtrgb
 [ ? ]  speech-dispatcher
 [ - ]  stop-bootlogd
 [ - ]  stop-bootlogd-single
 [ - ]  sudo
 [ ? ]  udev
 [ ? ]  udev-fallback-graphics
 [ ? ]  udev-finish
 [ ? ]  udevmonitor
 [ ? ]  udevtrigger
 [ ? ]  ufw
 [ ? ]  umountfs
 [ ? ]  umountnfs.sh
 [ ? ]  umountroot
 [ - ]  unattended-upgrades
 [ - ]  urandom
 [ ? ]  vboxautostart-service
 [ ? ]  vboxballoonctrl-service
 [ ? ]  vboxdrv
 [ ? ]  vboxweb-service
 [ + ]  vmware
 [ ? ]  vmware-USBArbitrator
 [ + ]  vmware-workstation-server
 [ ? ]  whoopsie
 [ - ]  x11-common
root@frank-Jai:~# 

他们到底想通过这些来传达什么?+-

答案1

据我所知,

[ + ] means the service is running
[ - ] means the service is stopped
[ ? ] means the status of the service cannot be determined

我不知道在什么情况下无法确定服务的状态,但在一些这是因为服务控制已经从传统的 init 脚本移到了 upstart 作业中 - 在这种情况下,你可以使用以下方式查看其状态,initctl例如

$ service --status-all 2>&1 | grep mysql
 [ ? ]  mysql

$ initctl status mysql
mysql start/running, process 1182

service --status-all对于 upstart 作业来说,相当于initctl list

答案2

看看service实际情况是怎样的:

user@box:~$ sudo file $(which service)
/usr/sbin/service: POSIX shell script, ASCII text executable

这是一个 shell 脚本,因此您可以检查它。

service --status-all检查每个 init 脚本/etc/init.d是否支持status参数。如果支持,它会再次调用 init 脚本(这次使用参数)status并检查服务是否正在运行。

这意味着:

[ + ] Service running
[ - ] Service not running

[ ? ] Service might or might not be running, the script seemingly does not support a status parameter

相关内容