stop-webdav-ownCloud.sh 897 B

1234567891011121314151617181920212223242526272829303132
  1. #!/usr/bin/env bash
  2. #
  3. # SPDX-FileCopyrightText: 2014-2016 ownCloud, Inc.
  4. # SPDX-License-Identifier: AGPL-3.0-only
  5. #
  6. if ! command -v docker >/dev/null 2>&1; then
  7. echo "No docker executable found - skipped docker stop"
  8. exit 0;
  9. fi
  10. echo "Docker executable found - stop and remove docker containers"
  11. # retrieve current folder to remove the config from the parent folder
  12. thisFolder=`echo $0 | sed 's#env/stop-webdav-ownCloud\.sh##'`
  13. if [ -z "$thisFolder" ]; then
  14. thisFolder="."
  15. fi;
  16. # stopping and removing docker containers
  17. for container in `cat $thisFolder/dockerContainerOwnCloud.$EXECUTOR_NUMBER.webdav`; do
  18. echo "Stopping and removing docker container $container"
  19. # kills running container and removes it
  20. docker stop $container
  21. docker rm -f $container
  22. done;
  23. # cleanup
  24. rm $thisFolder/config.webdav.php
  25. rm $thisFolder/dockerContainerOwnCloud.$EXECUTOR_NUMBER.webdav