最初のコミット

This commit is contained in:
yuuki 2024-09-11 11:43:10 +00:00
commit cdf74efda0
3 changed files with 37 additions and 0 deletions

17
taiko-web-db-cron.sh Normal file
View file

@ -0,0 +1,17 @@
#!/bin/bash
set -eu
test "$(docker container inspect -f '{{.State.Status}}' taiko-mongo)" = "running"
cd ~/taiko-web-db
git reset --hard HEAD
docker exec -i taiko-mongo mongoexport --db taiko --collection users --out /dev/stdout | sort -n > users.json
docker exec -i taiko-mongo mongoexport --db taiko --collection songs --out /dev/stdout | sort -n > songs.json
docker exec -i taiko-mongo mongoexport --db taiko --collection scores --out /dev/stdout | sort -n > scores.json
git add *.json
git commit --author="BOT <bot@example.com>" -m "$(git diff --name-only --cached | paste -s -d ' ') が更新されました"
git push origin main

12
taiko-web-db.service Normal file
View file

@ -0,0 +1,12 @@
[Unit]
Description=My Taiko Web's DB Backup Service
[Service]
User=root
Group=root
WorkingDirectory=/root
ExecStart=bash taiko-web-db-cron.sh
Type=simple
[Install]
WantedBy=multi-user.target

8
taiko-web-db.timer Normal file
View file

@ -0,0 +1,8 @@
[Unit]
Description=My Taiko Web's DB Backup Cron Service
[Timer]
OnCalendar=*:0/1
[Install]
WantedBy=timers.target