| #!/usr/bin/env 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. |
| |
| # |
| # Base Vars |
| # |
| SCRIPT_NAME=`basename $0` |
| SCRIPT_DIR=`cd $(dirname $0) && pwd` |
| |
| # |
| # Functions |
| # |
| usage() { |
| echo "Usage: $SCRIPT_NAME -f </path/to/config> -n <app name>" |
| exit 1 |
| } |
| |
| # |
| # Parse cmd line args |
| # |
| while getopts "f:n:" opt; do |
| case "$opt" in |
| f) config=$OPTARG;; |
| n) app_name=$OPTARG;; |
| *) usage;; |
| esac |
| done |
| shift $((OPTIND-1)) |
| |
| if [ -z "$config" ] || [ -z "$app_name" ]; then |
| usage |
| fi |
| |
| # |
| # Source the config |
| # |
| source $config |
| |
| # |
| # Main |
| # |
| echo -e "\n## Stopping app $app_name" |
| sudo -u yarn $SLIDER_INST_DIR/bin/slider stop $app_name --manager $RM_ADDRESS || exit 1 |
| echo "SUCCESS" |
| |
| echo -e "\n## Destroying app $app_name" |
| sudo -u yarn $SLIDER_INST_DIR/bin/slider destroy $app_name --manager $RM_ADDRESS || exit 1 |
| echo "SUCCESS" |
| |
| exit 0 |