NAZWA
start-stop-daemon - uruchamia i zatrzymuje demony systemowe
SK\(/LADNIA
start-stop-daemon [opcja...] polecenie
OPIS
start-stop-daemon jest wykorzystywany do kontroli proces\(’ow uruchamianych i zatrzymywanych podczas prze\(/lączania tryb\(’ow pracy. Przez użycie jednej z opcji dopasowywania, można skonfigurowa\(’c start-stop-daemon do wyszukiwania istniejących instancji dzia\(/lającego procesu.
Note: unless --pid or --pidfile are specified, start-stop-daemon behaves similar to killall(1). start-stop-daemon will scan the process table looking for any processes which match the process name, parent pid, uid, and/or gid (if specified). Any matching process will prevent --start from starting the daemon. All matching processes will be sent the TERM signal (or the one specified via --signal or --retry) if --stop is specified. For daemons which have long-lived children which need to live through a --stop, you must specify a pidfile.
POLECENIA
-S, --start [--] argumenty | |
Sprawdza, czy dany proces jest już uruchomiony. Jeśli tak jest, to start-stop-daemon nie wykonuje żadnych czynności i kończy się, zwracając kod b\(/lędu 1 (lub 0, jeśli podano opcję --oknodo). Jeśli dany proces nie jest jeszcze uruchomiony, to go uruchamia, wykonując program określony albo opcją --exec, albo jeśli podano, opcją --startas. Wszelkie argumenty podane tuż po opcji -- są przekazywane do wykonywanego polecenia. | |
-K, --stop | Sprawdza, czy dany proces jest już uruchomiony. Jeśli tak jest, to start-stop-daemon wysy\(/la sygna\(/l określony opcją --signal i kończy swoją pracę z kodem b\(/lędu 0. Jeśli proces nie istnieje, start-stop-daemon kończy się z kodem b\(/lędu 1 (lub 0, jeśli podano opcję --oknodo). Jeżeli podano opcję --retry, to start-stop-daemon sprawdzi, czy proces(y) się zakończy\(/l(y). |
-T, --status | |
Check for the existence of a specified process, and returns an exit status code, according to the LSB Init Script Actions (since version 1.16.1). | |
-H, --help | Wyświetla informację o użytkowaniu programu i kończy dzia\(/lanie. |
-V, --version | |
Wyświetla informację o wersji programu i kończy dzia\(/lanie. |
OPCJE
Matching options
--pid pid | |
Check for a process with the specified pid (since version 1.17.6). The pid must be a number greater than 0. | |
--ppid ppid | |
Check for a process with the specified parent pid ppid (since version 1.17.7). The ppid must be a number greater than 0. | |
-p, --pidfile plik-pid | |
Sprawdza, czy proces utworzy\(/l plik plik-pid. Uwaga: używając wy\(/lącznie tej opcji dopasowania można wywo\(/la\(’c dzia\(/lanie na niew\(/laściwym procesie, jeśli stary proces zakończy\(/l się bez możliwości usunięcia pliku-pid. | |
-x, --exec plik_wykonywalny | |
Sprawdza procesy, będące instancją danego pliku-wykonywalnego Argument plik-wykonywalny powinien by\(’c pe\(/lną nazwą ścieżkową. Uwaga: może to nie dzia\(/la\(’c zgodnie z intencją w skryptach interpretowanych, jako że plik wykonywalny będzie wskazywa\(/l na interpreter. Proszę zią\(’c pod uwagę, że procesy dzia\(/lające wewnątrz chroota r\(’ownież zostaną dopasowane, więc mogą by\(’c konieczne dodatkowe warunki dopasowania. | |
-n, --name nazwa-procesu | |
Sprawdza procesy o nazwie nazwa-procesu. Nazwa-procesu jest z regu\(/ly plikową nazwą procesu, ale niekiedy może zosta\(’c zmieniona przez sam proces. Uwaga: w większości system\(’ow informacja ta jest pobierana z nazwy comm procesu z jądra, kt\(’ora może mie\(’c stosunkowo duże graniczenie d\(/lugości (zak\(/ladanie więcej niż 15 znak\(’ow nie będzie przenośne). | |
-u, --user username|uid | |
Sprawdza procesy będące w\(/lasnością użytkownika określonego nazwą-użytkownika lub uid-em. Uwaga: używanie samej opcji dopasowania spowoduje, że pod uwagę będą wzięte wszystkie procesy z pasującym użytkownikiem. |
Generic options
-g, --group group|gid | |
Podczas uruchamiania procesu zmienia grupę na grupę lub gid. | |
-s, --signal sygna\(/l | |
Przy operacji --stop, wysy\(/lany jest sygna\(/l o podanej wartości do zatrzymywanego procesu (domyślnie jest to TERM). | |
-R, --retry timeout|plan-dzia\(/lania | |
W czasie operacji --stop powoduje sprawdzenie przez start-stop-daemon, czy proces(y) się zakończy\(/l(y). Sprawdzanie jest powtarzane, jeżeli dzia\(/la jakikolwiek pasujący proces, dop\(’oki wszystkie się nie skończą. Jeżeli procesy się nie zakończą, podejmowane są akcje określone przez parametr plan-dzia\(/lania.
Jeżeli określono timeout zamiast planu-dzia\(/lania, to wtedy używany jest następujący plan dzia\(/lania: sygna\(/l/timeout/KILL/timeout, gdzie sygna\(/l jest określony za pomocą opcji --signal.
plan-dzia\(/lania jest listą co najmniej dw\(’och wartości oddzielonych znakami ukośnika (/); każdą z tych wartości może by\(’c albo -numer-sygna\(/lu lub [-]nazwa-sygna\(/lu, co oznacza wys\(/lanie tego sygna\(/lu, albo timeout, określający liczbę sekund, kt\(’orą należy czeka\(’c na zakończenie procesu, albo forever, oznaczający, że reszta planu dzia\(/lania ma by\(’c powtarzana dop\(’oki jest to konieczne.
Jeżeli osiągnięto koniec planu dzia\(/lania, a opcja forever nie zosta\(/la użyta, to start-stop-daemon kończy dzia\(/lanie z kodem b\(/lędu 2. Jeżeli zosta\(/l określony plan dzia\(/lania, to sygna\(/l podany w --signal jest ignorowany.
|
|
-a, --startas nazwa-ścieżki | |
Przy operacji --start, Uruchamiany jest program o określonej ścieżce. Jeśli brak tej opcji, domyślnie uruchamiany jest program podany w opcji --exec. | |
-t, --test | Wyświetlana jest czynnoś\(’c, jaką należa\(/loby wykona\(’c, a także zwracany jest odpowiedni kod b\(/lędu, jednakże opcja ta nie wykonuje żadnych operacji. |
-o, --oknodo | |
Zwracany jest kod b\(/lędu 0, nawet gdyby operacja nie zakończy\(/la się powodzeniem (zwr\(’oci\(/laby 1). | |
-q, --quiet | |
Nie są wyświetlane żadne informacje opr\(’ocz komunikat\(’ow o b\(/lędach. | |
-c, --chuid użytkownik|uid[:grupa|gid] | |
Change to this username/uid before starting the process. You can also specify a group by appending a :, then the group or gid in the same way as you would for the chown(1) command (user:group). If a user is specified without a group, the primary GID for that user is used. When using this option you must realize that the primary and supplemental groups are set as well, even if the --group option is not specified. The --group option is only for groups that the user isn’t normally a member of (like adding per process group membership for generic users like nobody). | |
-r, --chroot root | |
Zmienia katalog bieżący na root i czyni go g\(/l\(’ownym katalogiem (rootem) przed wystartowaniem procesu. Proszę zauważy\(’c, że plik pidfile jest tworzony po wykonaniu chroot. | |
-d, --chdir ścieżka | |
Chdir to path before starting the process. This is done after the chroot if the -r|--chroot option is set. When not specified, start-stop-daemon will chdir to the root directory before starting the process. | |
-b, --background | |
Typically used with programs that don’t detach on their own. This option will force start-stop-daemon to fork before starting the process, and force it into the background. Warning: start-stop-daemon cannot check the exit status if the process fails to execute for any reason. This is a last resort, and is only meant for programs that either make no sense forking on their own, or where it’s not feasible to add the code for them to do this themselves. | |
-C, --no-close | |
Do not close any file descriptor when forcing the daemon into the background (since version 1.16.5). Used for debugging purposes to see the process output, or to redirect file descriptors to log the process output. Only relevant when using --background. | |
-N, --nicelevel liczba | |
Zmienia priorytet uruchamianego procesu. | |
-P, --procsched polityka:priorytet | |
This alters the process scheduler policy and priority of the process before starting it (since version 1.15.0). The priority can be optionally specified by appending a : followed by the value. The default priority is 0. The currently supported policy values are other, fifo and rr. | |
-I, --iosched klasa:priorytet | |
This alters the IO scheduler class and priority of the process before starting it (since version 1.15.0). The priority can be optionally specified by appending a : followed by the value. The default priority is 4, unless class is idle, then priority will always be 7. The currently supported values for class are idle, best-effort and real-time. | |
-k, --umask maska | |
This sets the umask of the process before starting it (since version 1.13.22). | |
-m, --make-pidfile | |
Used when starting a program that does not create its own pid file. This option will make start-stop-daemon create the file referenced with --pidfile and place the pid into it just before executing the process. Note, the file will only be removed when stopping the program if --remove-pidfile is used. Note: This feature may not work in all cases. Most notably when the program being executed forks from its main process. Because of this, it is usually only useful when combined with the --background option. | |
--remove-pidfile | |
Used when stopping a program that does not remove its own pid file (since version 1.17.19). This option will make start-stop-daemon remove the file referenced with --pidfile after terminating the process. | |
-v, --verbose | |
Wyświetlane są dodatkowe komunikaty. |
KOD WYJŚCIA
0 | Żądana akcja zosta\(/la przeprowadzona. Jeżeli użyto --oknodo, to istnieje r\(’ownież możliwoś\(’c, że nic nie zosta\(/lo wykonane. Może się to sta\(’c, gdy podano --start, a pasujący proces już dzia\(/la\(/l lub gdy podano --stop i nie znaleziono pasującego procesu. |
1 | Jeżeli --oknodo nie zosta\(/lo podane i nic nie zosta\(/lo zrobione. |
2 | Jeżeli podano --stop i --retry, ale osiągnięto koniec harmonogramu, a procesy wciąż by\(/ly uruchomione. |
3 | Każdy inny b\(/ląd. |
Podczas użycia polecenia --status zwracane są następujące kody statusu: | |
0 | Program dzia\(/la. |
1 | Program nie dzia\(/la, a plik PID-u istnieje. |
3 | Program nie dzia\(/la. |
4 | Nie można określi\(’c statusu programu. |
PRZYK\(/LAD
Uruchamia demon food, jeśli jeszcze nie dzia\(/la (proces nazwany food, dzia\(/lający jako użytkownik food, z identyfikatorem procesu w pliku food.pid):
start-stop-daemon --start --oknodo --user food --name food \ --pidfile /run/food.pid --startas /usr/sbin/food \ --chuid food -- --daemon |
|
Wyślij SIGTERM do food i czekaj do 5 sekund na jego zakończenie: | |
start-stop-daemon --stop --oknodo --user food --name food \ --pidfile /run/food.pid --retry 5 |
|
Przyk\(/lad w\(/lasnego planu zatrzymywania food: | |
start-stop-daemon --stop --oknodo --user food --name food \ --pidfile /run/food.pid --retry=TERM/30/KILL/5 |
T\(/LUMACZE
Piotr Roszatycki <dexter>, 1999
Bartosz Feński <fenio>, 2004-2005
Robert Luberda <robert>, 2006-2008
Wiktor Wandachowicz <siryes>, 2008
Micha\(/l Ku\(/lach <michal.kulach>, 2012
Bartosz Feński <fenio>, 2004-2005
Robert Luberda <robert>, 2006-2008
Wiktor Wandachowicz <siryes>, 2008
Micha\(/l Ku\(/lach <michal.kulach>, 2012