From 0d1f1e29b58d5b258c0e6c3537cc38e09c4dcabc Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Wed, 18 Oct 2023 22:38:22 +0200 Subject: [PATCH] replace stop action in messenger --- bin/messenger | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/messenger b/bin/messenger index 8e7a568..84adc64 100755 --- a/bin/messenger +++ b/bin/messenger @@ -22,7 +22,7 @@ help() { -l debug|info|notice|warning|error Debug level - -a start|stop|restart + -a start|stop|restart|status EOH } @@ -35,6 +35,7 @@ on_interrupt() { start_messenger() { nohup php8.1 bin/console messenger:consume 2>/dev/null >/dev/null & + log -t -l notice "Started" } stop_messenger() { @@ -42,6 +43,10 @@ stop_messenger() { log -t -l notice "Stopped" } +get_pid() { + pgrep -f messenger:consume +} + main() { cd "$(dirname "0")" @@ -63,8 +68,10 @@ main() { elif [ "$ACTION" = "restart" ]; then stop_messenger start_messenger + elif [ "$ACTION" = "status" ]; then + get_pid else - log -l error "Action no defined." + log -l error "Action is required." fi exit 0