From a441e5455f1c9de6a6239f334824ef9bc9ef322f Mon Sep 17 00:00:00 2001 From: Ahmed Bayoumy Date: Tue, 20 Feb 2024 17:14:16 -0600 Subject: [PATCH] another bug fix (#53) --- node/poor_mans_cd.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/node/poor_mans_cd.sh b/node/poor_mans_cd.sh index cb635d9..2beb9e3 100755 --- a/node/poor_mans_cd.sh +++ b/node/poor_mans_cd.sh @@ -2,14 +2,13 @@ start_process() { GOEXPERIMENT=arenas go run ./... & - local process_pid=$! - local child_process_pid=$(pgrep -P $process_pid) - echo "Process started with PID $process_pid and child PID $child_process_pid" + main_process_id=$! + local child_process_pid=$(pgrep -P $main_process_id) + echo "process started with PID $main_process_id and child PID $child_process_pid" } is_process_running() { - local process_pid=$(ps -ef | grep "exe/node" | grep -v grep | awk '{print $2}') - ps -p $process_pid > /dev/null 2>&1 + ps -p $main_process_id > /dev/null 2>&1 return $? } @@ -40,7 +39,7 @@ start_process while true; do if ! is_process_running; then - echo "Process crashed or stopped. Restarting..." + echo "process crashed or stopped. restarting..." start_process fi