1
0
api/tmp/northflank.zsh

23 lines
649 B
Bash
Raw Normal View History

2024-04-11 16:54:12 +00:00
#!/bin/zsh
pass=`cat ~/.config/ai/api_card.json|jq -r .gitea_token`
/usr/bin/northflank exec service --project ent --service web --cmd "/app/data/api/backup.sh $pass"
function f(){
rm /app/data/api/backup.sh
echo '#!/bin/bash
pass=$1
git config --global user.email syui@syui.ai
git config --global user.name syui
cp -rf /app/data/new.sqlite /app/data/api/latest.sqlite
cp -rf /app/data/new.sqlite /app/data/api/`date '+%w'`.sqlite
cd /app/data/api
git remote add origin https://$pass@git.syui.ai/ai/api_sqlite
git add .
git commit -m backup
git push origin main
git remote rm origin
' >> /app/data/api/backup.sh
chmod +x /app/data/api/backup.sh
}