1
0

stop-swift-ceph.sh 1.3 KB

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