File size: 973 Bytes
745e0d5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #!/bin/bash
# Configuration from your images
REPO_ID="your-username/your-dataset"
HF_TOKEN="your-hf-token"
echo "---- System Starting ----"
echo "Restoring files from $REPO_ID..."
huggingface-cli download $REPO_ID \
--local-dir /home/user/storage \
--repo-type dataset \
--token $HF_TOKEN
cat <<EOF > /home/user/auto_backup.sh
#!/bin/bash
while true
do
sleep 300
echo "Backing up data to Hugging Face..."
huggingface-cli upload $REPO_ID /home/user/storage \
--repo-type dataset \
--token $HF_TOKEN
done
EOF
chmod +x /home/user/auto_backup.sh
/home/user/auto_backup.sh &
cat <<EOF > /home/user/final_backup.sh
#!/bin/bash
sleep 172200
echo "Hugging Face is about to restart soon. Taking final backup..."
huggingface-cli upload $REPO_ID /home/user/storage \
--repo-type dataset \
--token $HF_TOKEN
EOF
chmod +x /home/user/final_backup.sh
/home/user/final_backup.sh &
echo "--- System is Ready. Access via Web Terminal ---"
ttyd -p 7860 -W bash |