TermX / start.sh
vidbye's picture
Update start.sh
182d8ee verified
#!/bin/bash
echo "Starting container..."
# 🔐 HF login
hf auth login --token $HF_TOKEN
# 📥 Download dataset
hf download vidbye/Termux-DB --repo-type dataset --local-dir .
# 📦 Run apt-run.txt যদি থাকে
FILE="apt-run.txt"
if [ -f "$FILE" ]; then
echo "Running commands from $FILE..."
while IFS= read -r cmd || [ -n "$cmd" ]
do
# skip empty lines
[ -z "$cmd" ] && continue
echo "Running: $cmd"
# run command (fail হলেও stop করবে না)
bash -c "$cmd"
# শুধু status print করবে
if [ $? -ne 0 ]; then
echo "⚠️ Failed (ignored): $cmd"
else
echo "✅ Success: $cmd"
fi
echo "----------------------"
done < "$FILE"
else
echo "No apt-run.txt found, skipping..."
fi
# 🔄 Start auto sync (background)
nohup bash hf_sync.sh > hf_sync.log 2>&1 &
# 🚀 Start API server (main process)
exec python3 -m uvicorn app:app --host 0.0.0.0 --port 7860