stop-sftp-atmoz.sh 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/usr/bin/env bash
  2. #
  3. # SPDX-FileCopyrightText: 2015-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. if ! command -v docker >/dev/null 2>&1; then
  10. echo "No docker executable found - skipped docker stop"
  11. exit 0;
  12. fi
  13. echo "Docker executable found - stop and remove docker containers"
  14. # retrieve current folder to remove the config from the parent folder
  15. thisFolder=`echo $0 | sed 's#env/stop-sftp-atmoz\.sh##'`
  16. if [ -z "$thisFolder" ]; then
  17. thisFolder="."
  18. fi;
  19. # stopping and removing docker containers
  20. for container in `cat $thisFolder/dockerContainerAtmoz.$EXECUTOR_NUMBER.sftp`; do
  21. echo "Stopping and removing docker container $container"
  22. # kills running container and removes it
  23. docker stop $container
  24. docker rm -f $container
  25. done;
  26. # cleanup
  27. rm $thisFolder/config.sftp.php
  28. rm $thisFolder/dockerContainerAtmoz.$EXECUTOR_NUMBER.sftp