@@ -53,31 +53,28 @@ start_and_monitor() {
5353 shift
5454 local cmd_and_args=(" $@ " )
5555
56- while true ; do
57- if [ ! -x " ${cmd_and_args[0]} " ]; then
58- echo -e " [Manager] ERROR: Binary for '$name ' not found or not executable at '${cmd_and_args[0]} '.
59- Please ensure the binary exists and has execute permissions (e.g., 'chmod +x ${cmd_and_args[0]} ').
60- You can download the latest pre-built binary from: https://github.com/e04/$name /releases/"
61- return 1
62- fi
56+ if [ ! -x " ${cmd_and_args[0]} " ]; then
57+ echo -e " [Manager] ERROR: Binary for '$name ' not found or not executable at '${cmd_and_args[0]} '.
58+ Please ensure the binary exists and has execute permissions (e.g., 'chmod +x ${cmd_and_args[0]} ').
59+ You can download the latest pre-built binary from: https://github.com/e04/$name /releases/"
60+ return 1
61+ fi
6362
64- echo " [Manager] Starting '$name '..."
65-
66- " ${cmd_and_args[@]} " 2>&1 | while IFS= read -r line || [ -n " $line " ]; do
67- printf ' [%s:%s] %s\n' " $name " " $( date +' %Y-%m-%d %H:%M:%S' ) " " $line "
68- done
69-
70- exit_code=${PIPESTATUS[0]}
71-
72- if [ " $exit_code " -eq 137 ]; then
73- echo " [Manager] Process '$name ' was killed (SIGKILL). Shutting down manager and child processes."
74- kill -TERM " $PPID " 2> /dev/null
75- exit 1
76- fi
63+ echo " [Manager] Starting '$name '..."
7764
78- echo " [Manager] Process ' $name ' exited with code ${exit_code} . Restarting in 5 seconds... "
79- sleep 5
65+ " ${cmd_and_args[@]} " 2>&1 | while IFS= read -r line || [ -n " $line " ] ; do
66+ printf ' [%s:%s] %s\n ' " $name " " $( date + ' %Y-%m-%d %H:%M:%S ' ) " " $line "
8067 done
68+
69+ exit_code=${PIPESTATUS[0]}
70+
71+ if [ " $exit_code " -eq 137 ]; then
72+ echo " [Manager] Process '$name ' was killed (SIGKILL). Shutting down manager and child processes."
73+ kill -TERM " $PPID " 2> /dev/null
74+ exit 1
75+ fi
76+
77+ echo " [Manager] Process '$name ' exited with code ${exit_code} ."
8178}
8279
8380# --- Main Execution ---
0 commit comments