stop-swift-ceph.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. #
  3. # ownCloud
  4. #
  5. # This script stops the docker container the files_external tests were run
  6. # against. It will also revert the config changes done in start step.
  7. #
  8. # @author Morris Jobke
  9. # @author Robin McCorkell
  10. # @copyright 2015 ownCloud
  11. if ! command -v docker >/dev/null 2>&1; then
  12. echo "No docker executable found - skipped docker stop"
  13. exit 0;
  14. fi
  15. echo "Docker executable found - stop and remove docker containers"
  16. # retrieve current folder to remove the config from the parent folder
  17. thisFolder=`echo $0 | replace "stop-swift-ceph.sh" ""`
  18. if [ -z "$thisFolder" ]; then
  19. thisFolder="."
  20. fi;
  21. if [ -e $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift ]; then
  22. # stopping and removing docker containers
  23. for container in `cat $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift`; do
  24. if [ -n "$DEBUG" ]; then
  25. docker logs $container
  26. fi
  27. echo "Stopping and removing docker container $container"
  28. # kills running container and removes it
  29. docker stop $container
  30. docker rm -f $container
  31. done;
  32. fi;
  33. # cleanup
  34. rm -rf $thisFolder/swift.config.php
  35. rm -rf $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift
  36. rm -rf $thisFolder/dockerContainerCeph.$EXECUTOR_NUMBER.swift.sock