Krótka odpowiedź:
bad: Pokazuje Systemd Unit filesstatus włączenia
- zobaczysz tego rodzaju komunikat w systemach, które używają
systemd
możesz sprawdzić status włączenia za pomocą polecenia:
sudo systemctl is-enabled <unit-name>
jeśli plik jednostka jest natywna obsługa Systemd wtedy to daje moc enabled, disableditp Jeśli tak nie jest rodowitym Systemd usługa to da zgłosić taką wiadomość.
sudo systemctl is-enabled apache2
apache2.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install is-enabled apache2
enabled
ale z poleceniem:
systemctl status apache2
or
service apache2 status
daje status bad. (być może dlatego, że nie jest w stanie wydrukować pełnej wiadomości lub programista zdecydował się wydrukować bad)
Długa odpowiedź:
jakie są pliki jednostek systemowych?
Jednostki to obiekty, które systemd wie, jak zarządzać. Są to w zasadzie ustandaryzowana reprezentacja zasobów systemowych, którymi można zarządzać za pomocą pakietu demonów i którymi można manipulować za pomocą dostarczonych narzędzi. Może być używany do abstrakcyjnych usług, zasobów sieciowych, urządzeń, montowań systemów plików i izolowanych pul zasobów. Możesz przeczytać szczegółowe informacje o jednostkach systemowych tutaj i tutaj
przykład:
systemctl status apache2
* apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
`-apache2-systemd.conf
Active: active (running) since Wed 2016-10-12 14:29:42 UTC; 17s ago
Docs: man:systemd-sysv-generator(8)
Process: 1027 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
systemctl sprawdzi, czy apache2jest jednostką macierzystą, czy nie. Jeśli nie, poprosi systemd-sysv-generatoro wygenerowanie pliku w formacie jednostki, który zapewnia obsługę podobną do jednostek natywnych. W powyższym przykładzie wygenerowany plik jest przechowywany w
/lib/systemd/system/apache2.service.d/apache2-systemd.conf
Drop-In: /lib/systemd/system/apache2.service.d
`-apache2-systemd.conf
Uwaga: możesz znaleźć generator na /lib/systemd/system-generators/systemd-sysv-generatori możesz przeczytać więcej na ten temat
man systemd-sysv-generator
Główny punkt :
is-enabled NAME...
Checks whether any of the specified unit files are enabled (as with
enable). Returns an exit code of 0 if at least one is enabled,
non-zero otherwise. Prints the current enable status (see table).
To suppress this output, use --quiet.
Table 1. is-enabled output
+------------------+-------------------------+-----------+
|Name | Description | Exit Code |
+------------------+-------------------------+-----------+
|"enabled" | Enabled via | |
+------------------+ .wants/, .requires/ | |
|"enabled-runtime" | or alias symlinks | |
| | (permanently in | 0 |
| | /etc/systemd/system/, | |
| | or transiently in | |
| | /run/systemd/system/). | |
+------------------+-------------------------+-----------+
|"linked" | Made available through | |
+------------------+ one or more symlinks | |
|"linked-runtime" | to the unit file | |
| | (permanently in | |
| | /etc/systemd/system/ | |
| | or transiently in | > 0 |
| | /run/systemd/system/), | |
| | even though the unit | |
| | file might reside | |
| | outside of the unit | |
| | file search path. | |
+------------------+-------------------------+-----------+
|"masked" | Completely disabled, | |
+------------------+ so that any start | |
|"masked-runtime" | operation on it fails | |
| | (permanently in | > 0 |
| | /etc/systemd/system/ | |
| | or transiently in | |
| | /run/systemd/systemd/). | |
+------------------+-------------------------+-----------+
|"static" | The unit file is not | 0 |
| | enabled, and has no | |
| | provisions for enabling | |
| | in the "[Install]" | |
| | section. | |
+------------------+-------------------------+-----------+
|"indirect" | The unit file itself is | 0 |
| | not enabled, but it has | |
| | a non-empty Also= | |
| | setting in the | |
| | "[Install]" section, | |
| | listing other unit | |
| | files that might be | |
| | enabled. | |
+------------------+-------------------------+-----------+
|"disabled" | Unit file is not | > 0 |
| | enabled, but contains | |
| | an "[Install]" section | |
| | with installation | |
| | instructions. | |
+------------------+-------------------------+-----------+
|"bad" | Unit file is invalid or | > 0 |
| | another error occurred. | |
| | Note that is-enabled | |
| | will not actually | |
| | return this state, but | |
| | print an error message | |
| | instead. However the | |
| | unit file listing | |
| | printed by | |
| | list-unit-files might | |
| | show it. | |
+------------------+-------------------------+-----------+
jeśli uruchomimy polecenie:
sudo systemctl is-enabled ssh
enabled
sudo systemctl is-enabled docker
enabled
sudo systemctl is-enabled apache2
apache2.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install is-enabled apache2
enabled
możesz zobaczyć, czy jednostki są natywne dla systemd jak sshi docker, na powyższym wyjściu pokaże tylko enabled, a dla jednostek, które nie są natywne jak, apache2ale nadal są włączone, daje to wiadomości zamiast drukowania badtutaj z powodu tego warunku:
+------------------+-------------------------+-----------+
|"bad" | Unit file is invalid or | > 0 |
| | another error occurred. | |
| | Note that is-enabled | |
| | will not actually | |
| | return this state, but | |
| | print an error message | |
| | instead. However the | |
| | unit file listing | |
| | printed by | |
| | list-unit-files might | |
| | show it. | |
+------------------+-------------------------+-----------+
Rozwiązanie:
status badnie spowoduje problemu (nie jestem pewien, czy to zależy), ale nie zapewni wszystkich funkcji systemctl. możesz poczekać na następne wydanie, packagektóre będzie natywnie obsługiwane systemd. lub możesz napisać plik jednostkowy dla swojej usługi lub dowolnego innego zasobu, korzystając z podanych referencji.
Możesz przeczytać szczegółowo o systemd, systemctl i jednostkach, korzystając z poniższych odnośników:
Systemctl
Jednostki systemowe i tutaj
Systemd