ニジカ投稿局 https://tv.nizika.tv
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

42 lines
878 B

  1. #!/bin/sh
  2. set -eu
  3. recreateDB () {
  4. dbname="peertube_test$1"
  5. dropdb --if-exists "$dbname" 2>&1
  6. createdb -O peertube "$dbname"
  7. psql -c "CREATE EXTENSION pg_trgm;" "$dbname" &
  8. psql -c "CREATE EXTENSION unaccent;" "$dbname" &
  9. }
  10. removeFiles () {
  11. rm -rf "./test$1" "./config/local-test.json" "./config/local-test-$1.json" ~/.config/PeerTube/CLI-$1
  12. }
  13. dropRedis () {
  14. port=$((9000+$1))
  15. host="127.0.0.1"
  16. redis-cli -h "$host" KEYS "bull-127.0.0.1:$port*" | grep -v empty | xargs -r redis-cli -h "$host" DEL
  17. redis-cli -h "$host" KEYS "redis-127.0.0.1:$port*" | grep -v empty | xargs -r redis-cli -h "$host" DEL
  18. redis-cli -h "$host" KEYS "*redis-127.0.0.1:$port-" | grep -v empty | xargs -r redis-cli -h "$host" DEL
  19. }
  20. seq=$(seq 1 6)
  21. if [ ! -z ${1+x} ]; then
  22. seq=$1
  23. fi
  24. for i in $seq; do
  25. recreateDB "$i" &
  26. dropRedis "$i" &
  27. removeFiles "$i" &
  28. done
  29. wait