2025-04-18 06:10:16 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
2025-04-18 09:02:59 +00:00
|
|
|
set -e
|
|
|
|
|
|
2025-07-16 01:26:34 +00:00
|
|
|
if [ -f "/opt/maxkb/PG_VERSION" ]; then
|
2025-07-01 08:01:49 +00:00
|
|
|
# 如果是v1版本一键安装的的目录则退出
|
2025-07-16 02:50:03 +00:00
|
|
|
echo "FATAL ERROR: Upgrade from v1 to v2 is not supported."
|
|
|
|
|
echo "The process will exit."
|
2025-07-01 08:01:49 +00:00
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
|
2025-04-18 06:10:16 +00:00
|
|
|
if [ "$MAXKB_DB_HOST" = "127.0.0.1" ]; then
|
2025-04-21 07:39:29 +00:00
|
|
|
echo "PostgreSQL starting..."
|
|
|
|
|
/usr/bin/start-postgres.sh &
|
2025-07-01 08:01:49 +00:00
|
|
|
postgres_pid=$!
|
2025-04-21 07:39:29 +00:00
|
|
|
sleep 10
|
|
|
|
|
wait-for-it 127.0.0.1:5432 --timeout=120 --strict -- echo "PostgreSQL started."
|
2025-04-18 06:10:16 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
if [ "$MAXKB_REDIS_HOST" = "127.0.0.1" ]; then
|
2025-04-21 07:39:29 +00:00
|
|
|
echo "Redis starting..."
|
|
|
|
|
/usr/bin/start-redis.sh &
|
2025-07-01 08:01:49 +00:00
|
|
|
redis_pid=$!
|
2025-04-21 07:39:29 +00:00
|
|
|
sleep 5
|
|
|
|
|
wait-for-it 127.0.0.1:6379 --timeout=60 --strict -- echo "Redis started."
|
2025-04-18 06:10:16 +00:00
|
|
|
fi
|
|
|
|
|
|
2025-07-01 08:01:49 +00:00
|
|
|
/usr/bin/start-maxkb.sh &
|
|
|
|
|
maxkb_pid=$!
|
|
|
|
|
|
|
|
|
|
wait -n
|
|
|
|
|
kill $postgres_pid $redis_pid $maxkb_pid 2>/dev/null
|
|
|
|
|
wait
|