Speaup clean script

pull/1074/head
Chocobozzz 2018-09-14 10:07:33 +02:00
parent d5f044cef2
commit 780daa7e91
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 20 additions and 6 deletions

View File

@ -2,14 +2,28 @@
set -eu set -eu
for i in $(seq 1 6); do recreateDB () {
dbname="peertube_test$i" dbname="peertube_test$1"
dropdb --if-exists "$dbname" dropdb --if-exists "$dbname"
rm -rf "./test$i" "./config/local-test.json" "./config/local-test-$i.json"
createdb -O peertube "$dbname" createdb -O peertube "$dbname"
psql -c "CREATE EXTENSION pg_trgm;" "$dbname" psql -c "CREATE EXTENSION pg_trgm;" "$dbname" &
psql -c "CREATE EXTENSION unaccent;" "$dbname" psql -c "CREATE EXTENSION unaccent;" "$dbname" &
redis-cli KEYS "bull-localhost:900$i*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL }
removeFiles () {
rm -rf "./test$1" "./config/local-test.json" "./config/local-test-$1.json"
}
dropRedis () {
redis-cli KEYS "bull-localhost:900$1*" | grep -v empty | xargs --no-run-if-empty redis-cli DEL
}
for i in $(seq 1 6); do
recreateDB "$i" &
dropRedis "$i" &
removeFiles "$i" &
done done
wait