改进软链接创建逻辑,确保指向正确的目录

This commit is contained in:
yhydev
2025-12-13 23:49:57 +08:00
parent a85d8735c0
commit 205f5dd099

View File

@@ -37,8 +37,19 @@ if [ ! -d $WORKING_DIR/user_data ]; then
freqtrade create-userdir --userdir $WORKING_DIR/user_data;
fi
mkdir -p $WORKING_DIR/user_data/data/binance;
if [ ! -L $WORKING_DIR/user_data/data/binance/futures ]; then
ln -s $BINANCE_FUTURES_DIR $WORKING_DIR/user_data/data/binance/futures;
# Check if the symlink exists and points to the correct directory
SYMLINK_PATH="$WORKING_DIR/user_data/data/binance/futures"
if [ -L "$SYMLINK_PATH" ]; then
# Get the actual target of the symlink
CURRENT_TARGET=$(readlink "$SYMLINK_PATH")
if [ "$CURRENT_TARGET" != "$BINANCE_FUTURES_DIR" ]; then
echo "Symlink exists but points to wrong target. Removing and recreating..."
rm -f "$SYMLINK_PATH"
ln -s "$BINANCE_FUTURES_DIR" "$SYMLINK_PATH"
fi
else
# Symlink doesn't exist, create it
ln -s "$BINANCE_FUTURES_DIR" "$SYMLINK_PATH"
fi;
cd $WORKING_DIR;
if [ ! -f ~/.local/bin/mc ]; then