From 017fc9e1aaf430d12ed47cea3fb56161c977c3d8 Mon Sep 17 00:00:00 2001 From: Arsen Mirzaev Tatyano-Muradovich Date: Mon, 15 Apr 2024 23:54:57 +0700 Subject: [PATCH] systemd service and something --- .../telegram/registry/requests/system/public/robot.php | 2 +- telegram-robot.service | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mirzaev/spetsresurs/telegram/registry/requests/system/public/robot.php b/mirzaev/spetsresurs/telegram/registry/requests/system/public/robot.php index 9fad8c0..27284af 100755 --- a/mirzaev/spetsresurs/telegram/registry/requests/system/public/robot.php +++ b/mirzaev/spetsresurs/telegram/registry/requests/system/public/robot.php @@ -346,7 +346,7 @@ function request_confirmed(Context $ctx): void // Прочитана запрашиваемая заявка // Инициализация инстанции task в базе данных (выбранного задания) - $task = collection::search($arangodb->session, sprintf("FOR d IN task FILTER d._key == '%s' && d.published == true && d.completed != true RETURN d", $_key)); + $task = collection::search($arangodb->session, sprintf("FOR d IN task FILTER d._key == '%s' && d.published == true && d.completed != true && worker == null RETURN d", $_key)); if ($worker ??= worker($account->getId())) { // Найден сотрудник diff --git a/telegram-robot.service b/telegram-robot.service index 405809e..eaf8a1e 100755 --- a/telegram-robot.service +++ b/telegram-robot.service @@ -1,6 +1,9 @@ [Unit] Description=Telegram-robot +Wants=network.target +After=syslog.target network-online.target + [Service] ExecStart=sudo -u www-data /usr/bin/php /var/www/spetsresurs-telegram-registry-requests/mirzaev/spetsresurs/telegram/registry/requests/system/public/robot.php PIDFile=/var/run/php/telegram-robot.pid @@ -8,3 +11,6 @@ RemainAfterExit=no RuntimeMaxSec=3600s Restart=always RestartSec=5s + +[Install] +WantedBy=multi-user.target