The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]



Вариант для распечатки  
Пред. тема | След. тема 
Форум Разговоры, обсуждение новостей
Режим отображения отдельной подветви беседы [ Отслеживать ]

Оглавление

Debian возвращается к вопросу поддержки нескольких систем ин..., opennews (??), 19-Сен-19, (0) [смотреть все]

Сообщения [Сортировка по времени | RSS]


288. "Debian возвращается к вопросу поддержки нескольких систем ин..."  +/
Сообщение от FSA (??), 19-Сен-19, 21:49 
> Две строчки не осили написать?

У меня была простая задача. Запустить демона на php для умного дома. Демон самописный. Ничего такого хитрого. Сначала по старинке через init скрипт пытался запустить. Потом оказалось надо юзера группу нужный выставить для демона, перед запуском дождаться хотя бы сервера баз данных, ибо оттуда надо скачать данные перед запуском, нехило было бы подождать веб-сервер, потому что демон шлёт туда по http данные. Ещё нужен cron, да такой, чтобы у всех работал. А ещё неплохо было бы где-то pid процесса хранить, а ещё кеш, а то негоже гонять каждый раз mp3 с голосом сколько сейчас времени или ещё какой хрени, а ещё логи бы куда-то писать. Короче, плюнул я на всё это. Хотите любиться с другими системами инициализации, флаг вам в руки. Я предложил простое решение для systemd. Все нужные папки создаются автоматом, всё запускается как требуется. И я точно уверен, что у всех с systemd также будет работать.

Ответить | Правка | К родителю #33 | Наверх | Cообщить модератору

335. "Debian возвращается к вопросу поддержки нескольких систем ин..."  +/
Сообщение от Аноним (346), 20-Сен-19, 03:02 
> Потом оказалось надо юзера группу нужный выставить для демона, перед запуском дождаться хотя бы сервера баз данных, ибо оттуда надо скачать данные перед запуском, нехило было бы подождать веб-сервер, потому что демон шлёт туда по http данные.

Мне кажется кто-то люто пиzдит. Зависимости в init-скриптах через Required-Start/Stop уже тыщщу лет были, а плюшки запуска процессов обеспечиваются через стандартный start-stop-daemon:

DESCRIPTION
       start-stop-daemon  is used to control the creation and termination of system-level processes.  Using one of the matching options, start-stop-daemon can be
       configured to find existing instances of a running process.

   Generic options
       -g, --group group|gid
              Change to group or gid when starting the process.

       -c, --chuid username|uid[:group|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).

       -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.

       -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.

Ответить | Правка | Наверх | Cообщить модератору

Архив | Удалить

Рекомендовать для помещения в FAQ | Индекс форумов | Темы | Пред. тема | След. тема




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру