mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-03-03 22:53:00 +00:00
Compare commits
4 commits
6b6818efa4
...
e9757350f3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e9757350f3 | ||
|
|
fcf86063f3 | ||
|
|
20ca19233a | ||
|
|
ba07e15695 |
3 changed files with 35 additions and 6 deletions
|
|
@ -2,11 +2,22 @@
|
||||||
|
|
||||||
FINISH_FILE="$GEODATA_DIR/cron-job-finished.txt"
|
FINISH_FILE="$GEODATA_DIR/cron-job-finished.txt"
|
||||||
|
|
||||||
while [ ! -f "$FINISH_FILE" ]; do
|
MAX_WAIT=300 # 5 minutes
|
||||||
echo "Still waiting... (looking for $FINISH_FILE)"
|
ELAPSED=0
|
||||||
sleep 10
|
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
|
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
|
# Start fail2ban
|
||||||
[ "$XUI_ENABLE_FAIL2BAN" = "true" ] && fail2ban-client -x start
|
[ "$XUI_ENABLE_FAIL2BAN" = "true" ] && fail2ban-client -x start
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ services:
|
||||||
build:
|
build:
|
||||||
context: docker-cron-runner
|
context: docker-cron-runner
|
||||||
args:
|
args:
|
||||||
XRAY_VERSION: "v25.10.15"
|
XRAY_VERSION: "${XRAY_VERSION:-v25.10.15}"
|
||||||
XRAY_BUILD_DIR: "/app/xray"
|
XRAY_BUILD_DIR: "/app/xray"
|
||||||
container_name: geodata_cron
|
container_name: geodata_cron
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
|
||||||
|
|
@ -122,11 +122,29 @@ install_xray_core() {
|
||||||
cd "$XRAYDIR"
|
cd "$XRAYDIR"
|
||||||
|
|
||||||
wget -q "https://github.com/XTLS/Xray-core/releases/download/${XRAY_VERSION}/Xray-linux-${ARCH}.zip"
|
wget -q "https://github.com/XTLS/Xray-core/releases/download/${XRAY_VERSION}/Xray-linux-${ARCH}.zip"
|
||||||
unzip "Xray-linux-${ARCH}.zip" -d ./xray-unzip
|
|
||||||
|
# Validate the downloaded zip file
|
||||||
|
if [ ! -f "Xray-linux-${ARCH}.zip" ] || [ ! -s "Xray-linux-${ARCH}.zip" ]; then
|
||||||
|
echo "[ERR] Failed to download Xray-core zip or file is empty"
|
||||||
|
cd "$OLD_DIR"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
unzip -q "Xray-linux-${ARCH}.zip" -d ./xray-unzip
|
||||||
|
|
||||||
|
# Validate the extracted xray binary
|
||||||
|
if [ ! -f "./xray-unzip/xray" ] || [ ! -s "./xray-unzip/xray" ]; then
|
||||||
|
echo "[ERR] Failed to extract xray binary"
|
||||||
|
rm -rf ./xray-unzip
|
||||||
|
rm -f "Xray-linux-${ARCH}.zip"
|
||||||
|
cd "$OLD_DIR"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
cp ./xray-unzip/xray ./"xray-linux-${FNAME}"
|
cp ./xray-unzip/xray ./"xray-linux-${FNAME}"
|
||||||
rm -r xray-unzip
|
rm -r xray-unzip
|
||||||
rm "Xray-linux-${ARCH}.zip"
|
rm "Xray-linux-${ARCH}.zip"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "${0##*/}" = "xray-tools.sh" ]; then
|
if [ "${0##*/}" = "xray-tools.sh" ]; then
|
||||||
cmd="$1"
|
cmd="$1"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue