mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-12-23 06:42:41 +00:00
add timeout mechanism and better error handling
This commit is contained in:
parent
6b6818efa4
commit
ba07e15695
1 changed files with 14 additions and 3 deletions
|
|
@ -2,11 +2,22 @@
|
|||
|
||||
FINISH_FILE="$GEODATA_DIR/cron-job-finished.txt"
|
||||
|
||||
while [ ! -f "$FINISH_FILE" ]; do
|
||||
echo "Still waiting... (looking for $FINISH_FILE)"
|
||||
sleep 10
|
||||
MAX_WAIT=300 # 5 minutes
|
||||
ELAPSED=0
|
||||
INTERVAL=10
|
||||
|
||||
while [ ! -f "$FINISH_FILE" ] && [ $ELAPSED -lt $MAX_WAIT ]; do
|
||||
echo "Still waiting for geodata initialization... ($ELAPSED/$MAX_WAIT seconds)"
|
||||
sleep $INTERVAL
|
||||
ELAPSED=$((ELAPSED + INTERVAL))
|
||||
done
|
||||
|
||||
if [ ! -f "$FINISH_FILE" ]; then
|
||||
echo "ERROR: Geodata initialization timed out after $MAX_WAIT seconds"
|
||||
echo "Container startup aborted."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Start fail2ban
|
||||
[ "$XUI_ENABLE_FAIL2BAN" = "true" ] && fail2ban-client -x start
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue