newapi / entrypoint-wrapper.sh
nomid2's picture
Update entrypoint-wrapper.sh
4074c5f verified
raw
history blame
1.06 kB
#!/bin/sh
APP_DATA_DIR="/tmp/data"
echo "Entrypoint wrapper: Attempting to create necessary directories in ephemeral FS..."
echo "Ensuring directory $APP_DATA_DIR exists (for SQLite or other app data)..."
mkdir -p "$APP_DATA_DIR"
mkdir -p "$APP_DATA_DIR/logs" # 预先创建logs目录
if [ $? -ne 0 ]; then
echo "ERROR: Failed to create $APP_DATA_DIR. Application data storage might fail."
else
echo "$APP_DATA_DIR was created or already exists."
echo "Listing permissions for /tmp:"
ls -ld /tmp
echo "Listing permissions for $APP_DATA_DIR:"
ls -ld "$APP_DATA_DIR"
echo "Attempting to create a test file in $APP_DATA_DIR:"
touch "$APP_DATA_DIR/test_writable.txt"
if [ $? -eq 0 ]; then
echo "$APP_DATA_DIR is writable, test file created."
rm "$APP_DATA_DIR/test_writable.txt"
else
echo "$APP_DATA_DIR is NOT writable directly by this script for creating files."
fi
fi
echo "Entrypoint wrapper: Starting application with custom log directory"
exec /one-api -log-dir "$APP_DATA_DIR/logs"