mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-04-29 10:55:56 +00:00
Compare commits
No commits in common. "e9757350f340e677127aeff1093fc2dd55c63c61" and "6b6818efa41a78f8803ee2ccd1a1af14cea79b05" have entirely different histories.
e9757350f3
...
6b6818efa4
3 changed files with 6 additions and 35 deletions
|
|
@ -2,22 +2,11 @@
|
||||||
|
|
||||||
FINISH_FILE="$GEODATA_DIR/cron-job-finished.txt"
|
FINISH_FILE="$GEODATA_DIR/cron-job-finished.txt"
|
||||||
|
|
||||||
MAX_WAIT=300 # 5 minutes
|
while [ ! -f "$FINISH_FILE" ]; do
|
||||||
ELAPSED=0
|
echo "Still waiting... (looking for $FINISH_FILE)"
|
||||||
INTERVAL=10
|
sleep 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: "${XRAY_VERSION:-v25.10.15}"
|
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,29 +122,11 @@ 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