stop servers on error in run script

pull/21833/head
Bruno Windels 2018-07-27 18:44:01 +02:00
parent 758da78659
commit 29d688543d
2 changed files with 16 additions and 4 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
PORT=5000 PORT=5000
echo "running riot on http://localhost:$PORT..." echo "running riot on http://localhost:$PORT ..."
BASE_DIR=$(readlink -f $(dirname $0)) BASE_DIR=$(readlink -f $(dirname $0))
cd $BASE_DIR/ cd $BASE_DIR/
pushd riot-web/webapp/ > /dev/null pushd riot-web/webapp/ > /dev/null

18
run.sh
View File

@ -1,7 +1,19 @@
#!/bin/bash #!/bin/bash
set -e
stop_servers() {
./riot/stop.sh
./synapse/stop.sh
}
handle_error() {
EXIT_CODE=$?
stop_servers
exit $EXIT_CODE
}
trap 'handle_error' ERR
./synapse/start.sh ./synapse/start.sh
./riot/start.sh ./riot/start.sh
node start.js node start.js
./riot/stop.sh stop_servers
./synapse/stop.sh