split up utility script for stopping and removing stratos images

Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/4043308d
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/4043308d
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/4043308d

Branch: refs/heads/master
Commit: 4043308d83a6f4878cbe20b5e057058f207bb847
Parents: 3e6d635
Author: Chris Snow <[email protected]>
Authored: Sun Aug 31 09:45:25 2014 +0000
Committer: Chris Snow <[email protected]>
Committed: Sun Aug 31 09:45:25 2014 +0000

----------------------------------------------------------------------
 .../remove_stratos_images.sh                    | 33 ++++++++++++++++++++
 .../stop_and_remove_stratos_containers.sh       | 31 ------------------
 .../stop_stratos_containers.sh                  | 31 ++++++++++++++++++
 3 files changed, 64 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/4043308d/tools/stratos-docker-images/remove_stratos_images.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-docker-images/remove_stratos_images.sh 
b/tools/stratos-docker-images/remove_stratos_images.sh
new file mode 100755
index 0000000..893940c
--- /dev/null
+++ b/tools/stratos-docker-images/remove_stratos_images.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+# ----------------------------------------------------------------------------
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+# ----------------------------------------------------------------------------
+
+set -e
+set -u
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+./$SCRIPT_DIR/stop_stratos_containers.sh
+
+stratos_image_ids=$(docker images -a | grep '^apachestratos' | awk '{print 
$3}')
+if [[ -n $stratos_image_ids ]]; then
+  docker rmi $stratos_image_ids
+fi

http://git-wip-us.apache.org/repos/asf/stratos/blob/4043308d/tools/stratos-docker-images/stop_and_remove_stratos_containers.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-docker-images/stop_and_remove_stratos_containers.sh 
b/tools/stratos-docker-images/stop_and_remove_stratos_containers.sh
deleted file mode 100755
index b2ff6c3..0000000
--- a/tools/stratos-docker-images/stop_and_remove_stratos_containers.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-# ----------------------------------------------------------------------------
-#
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-#  regarding copyright ownership.  The ASF licenses this file
-#  to you under the Apache License, Version 2.0 (the
-#  "License"); you may not use this file except in compliance
-#  with the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing,
-#  software distributed under the License is distributed on an
-#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#  KIND, either express or implied.  See the License for the
-#  specific language governing permissions and limitations
-#  under the License.
-#
-# ----------------------------------------------------------------------------
-
-set -e
-set -u
-
-stratos_container_ids=$(sudo docker ps -a | awk '{print $2, $1}' | grep 
'^apachestratos' | awk '{print $2}')
-
-if [[ -n $stratos_container_ids ]]; then
-  sudo docker stop $stratos_container_ids
-  sudo docker rm $stratos_container_ids
-fi

http://git-wip-us.apache.org/repos/asf/stratos/blob/4043308d/tools/stratos-docker-images/stop_stratos_containers.sh
----------------------------------------------------------------------
diff --git a/tools/stratos-docker-images/stop_stratos_containers.sh 
b/tools/stratos-docker-images/stop_stratos_containers.sh
new file mode 100755
index 0000000..2296987
--- /dev/null
+++ b/tools/stratos-docker-images/stop_stratos_containers.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# ----------------------------------------------------------------------------
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+# ----------------------------------------------------------------------------
+
+set -e
+set -u
+
+running_stratos_container_ids=$(docker ps -a | awk '{print $2, $1}' | grep 
'^apachestratos' | awk '{print $2}')
+
+if [[ -n $running_stratos_container_ids ]]; then
+  docker stop $running_stratos_container_ids
+  docker rm $running_stratos_container_ids
+fi

Reply via email to