You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.8 KiB
Bash

10 months ago
#!/bin/bash
# 初始化数据库
#if [ -f "/app/lemon/mysql_app.sql" ];then
# echo "Initializing MySQL database..."
# # 初始化数据库
# mysql -h lemon_mysql -u root -pSghjdA887# aiplatform < /app/lemon/mysql_app.sql
# echo "MySQL initialization completed."
#else
# echo "Mysql init errorinit sql file does not exist"
#fi
#search_dir="/app/lemon"
#for entry in `ls $search_dir`; do
# echo "正在加载文件:$entry"
#done
#for entry in "$search_dir"/*; do
# echo "正在加载文件:$(basename "$entry")"
#done
# 更新配置文件
if [ ! -f "/app/lemon/website/settings_local.py" ];then
echo "@@init settings_local file"
cat > /app/lemon/website/settings_local.py << EOF
mysql_app = {
"host": "lemon_mysql:3306",
"database": "aiplatform",
"user": "root",
"password": "SghjdA887#",
"time_zone": "+8:00"
}
redis_app = ("lemon_redis", 6379, 0, "hgkiYY87")
file_upload_dir = "/app/fileupload"
EOF
fi
# 设置要列出的目录
dir_path="/app/lemon"
# 递归打印目录结构
function print_dir_structure() {
local dir="$1"
local indent="$2"
# 打印当前目录
echo "$indent$(basename "$dir")"
# 遍历目录下的所有项目
for item in "$dir"/*
do
# 如果是目录,递归打印
if [ -d "$item" ]; then
print_dir_structure "$item" "$indent "
# 如果是文件,打印文件名
elif [ -f "$item" ]; then
echo "$indent $(basename "$item")"
fi
done
}
# print_dir_structure "$dir_path" "-"
# 启动Tornado应用程序
#echo "启动Tornado应用程序"
#if [ -f "/app/lemon/website/app.py" ];then
# echo "@@app.py存在"
# python /app/lemon/website/app.py --port=8889 >> /app/log/lemon.log 2>&1
#else
# echo "app.py文件错误文件不存在"
#fi
echo "启动完成"