nomid2 commited on
Commit
4074c5f
·
verified ·
1 Parent(s): 01016cf

Update entrypoint-wrapper.sh

Browse files
Files changed (1) hide show
  1. entrypoint-wrapper.sh +24 -19
entrypoint-wrapper.sh CHANGED
@@ -1,24 +1,29 @@
1
  #!/bin/sh
2
 
3
- echo "=== Checking one-api help and version ==="
4
- /one-api --help 2>&1 || echo "No --help option"
5
- /one-api -h 2>&1 || echo "No -h option"
6
- /one-api version 2>&1 || echo "No version command"
7
- /one-api --version 2>&1 || echo "No --version option"
8
-
9
- echo "=== Checking for config file support ==="
10
- ls -la /one-api* 2>/dev/null || echo "Cannot list one-api files"
11
-
12
- echo "=== Attempting to start with various config options ==="
13
  APP_DATA_DIR="/tmp/data"
14
- mkdir -p "$APP_DATA_DIR/logs"
15
 
16
- # 尝试各种可能的环境变量和启动参数
17
- export DATA_PATH="$APP_DATA_DIR"
18
- export LOG_PATH="$APP_DATA_DIR/logs"
19
- export ONE_API_DATA_DIR="$APP_DATA_DIR"
20
- export ONE_API_LOG_DIR="$APP_DATA_DIR/logs"
21
- export SQLITE_PATH="$APP_DATA_DIR/one-api.db"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
- echo "Starting application with custom environment variables..."
24
- exec /one-api
 
1
  #!/bin/sh
2
 
 
 
 
 
 
 
 
 
 
 
3
  APP_DATA_DIR="/tmp/data"
 
4
 
5
+ echo "Entrypoint wrapper: Attempting to create necessary directories in ephemeral FS..."
6
+
7
+ echo "Ensuring directory $APP_DATA_DIR exists (for SQLite or other app data)..."
8
+ mkdir -p "$APP_DATA_DIR"
9
+ mkdir -p "$APP_DATA_DIR/logs" # 预先创建logs目录
10
+ if [ $? -ne 0 ]; then
11
+ echo "ERROR: Failed to create $APP_DATA_DIR. Application data storage might fail."
12
+ else
13
+ echo "$APP_DATA_DIR was created or already exists."
14
+ echo "Listing permissions for /tmp:"
15
+ ls -ld /tmp
16
+ echo "Listing permissions for $APP_DATA_DIR:"
17
+ ls -ld "$APP_DATA_DIR"
18
+ echo "Attempting to create a test file in $APP_DATA_DIR:"
19
+ touch "$APP_DATA_DIR/test_writable.txt"
20
+ if [ $? -eq 0 ]; then
21
+ echo "$APP_DATA_DIR is writable, test file created."
22
+ rm "$APP_DATA_DIR/test_writable.txt"
23
+ else
24
+ echo "$APP_DATA_DIR is NOT writable directly by this script for creating files."
25
+ fi
26
+ fi
27
 
28
+ echo "Entrypoint wrapper: Starting application with custom log directory"
29
+ exec /one-api -log-dir "$APP_DATA_DIR/logs"