fix(init): guard against duplicate jibo-system-manager starts

This commit is contained in:
G. H. Chinoy
2026-08-02 12:28:16 -06:00
parent d265aa80d6
commit 4c8f2edbfe
@@ -34,7 +34,7 @@ check_mode() {
} }
check_running() { check_running() {
pgrep -x jibo-system-man >& /dev/null pgrep -f "$BIN_DIR/$PROCESS" > /dev/null 2>&1
return $? return $?
} }
@@ -46,8 +46,12 @@ wait_for_stopped() {
} }
start() { start() {
echo -n "Starting $PROCESS: "
check_mode check_mode
if check_running; then
echo "jibo-system-manager is ALREADY RUNNING (PID: $(pgrep -f "$BIN_DIR/$PROCESS"))"
return 0
fi
echo -n "Starting $PROCESS: "
$BIN_DIR/$PROCESS -c $CFG_DIR/$PROCESS.json --daemon $BIN_DIR/$PROCESS -c $CFG_DIR/$PROCESS.json --daemon
test $? -eq 0 && echo "OK" || echo "ERROR" test $? -eq 0 && echo "OK" || echo "ERROR"
} }