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