48 lines
899 B
Bash
48 lines
899 B
Bash
#!/usr/bin/env bash
|
|
|
|
show_help() {
|
|
echo "Restart
|
|
The script for restarting the web app. This script calls the necessary commands to restart the containers which house the web app.
|
|
|
|
Usage restart.sh [OPTIONS]
|
|
|
|
Options:
|
|
-b|--build: Runs the build script as part of restarting the web app.
|
|
-h|--help: Shows this help message
|
|
"
|
|
}
|
|
|
|
run_build=false
|
|
|
|
while [[ "$#" -gt 0 ]]; do
|
|
case "$1" in
|
|
-b|--build)
|
|
run_build=true
|
|
shift 1
|
|
;;
|
|
-h|--help)
|
|
show_help
|
|
exit
|
|
;;
|
|
*)
|
|
echo "Invalid argument given ($1)"
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
cur_dir="$(cd "$( dirname "$0")" && pwd)"
|
|
|
|
start_script="$cur_dir/start.sh"
|
|
build_script="$cur_dir/build.sh"
|
|
stop_script="$cur_dir/stop.sh"
|
|
|
|
# any of these failing should cause this script to fail
|
|
set -e
|
|
$stop_script
|
|
# run a build if we are supposed to
|
|
if "$run_build"; then
|
|
$build_script
|
|
fi
|
|
$start_script
|