stop-sftp-atmoz.sh 1023 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/env 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. # @copyright 2015 Morris Jobke <hey@morrisjobke.de>
  10. #
  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 | sed 's#env/stop-sftp-atmoz\.sh##'`
  18. if [ -z "$thisFolder" ]; then
  19. thisFolder="."
  20. fi;
  21. # stopping and removing docker containers
  22. for container in `cat $thisFolder/dockerContainerAtmoz.$EXECUTOR_NUMBER.sftp`; do
  23. echo "Stopping and removing docker container $container"
  24. # kills running container and removes it
  25. docker stop $container
  26. docker rm -f $container
  27. done;
  28. # cleanup
  29. rm $thisFolder/config.sftp.php
  30. rm $thisFolder/dockerContainerAtmoz.$EXECUTOR_NUMBER.sftp