Mercurial > lada > lada-server
annotate wildfly/execute.sh @ 1184:4c612aaba378
LAF requires char sequences to be quoted in export.
Not doing this also could lead to invalid output resulting from
strings with spaces.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 18 Nov 2016 21:42:27 +0100 |
parents | 75e87b7d37c0 |
children |
rev | line source |
---|---|
748
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
1 #!/bin/bash |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
2 |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
3 if [ -z $JBOSS_HOME ] |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
4 then |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
5 JBOSS_HOME=/opt/jboss/wildfly |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
6 fi |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
7 JBOSS_CLI=$JBOSS_HOME/bin/jboss-cli.sh |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
8 JBOSS_MODE=${1:-"standalone"} |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
9 JBOSS_CONFIG=${2:-"$JBOSS_MODE.xml"} |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
10 |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
11 function wait_for_server() { |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
12 until `$JBOSS_CLI -c "ls /deployment" &> /dev/stdout`; do |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
13 sleep 1 |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
14 done |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
15 } |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
16 |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
17 function wait_for_shutdown() { |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
18 until `$JBOSS_CLI -c "ls /deployment" &> /dev/stdout`; do |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
19 sleep 1 |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
20 done |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
21 } |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
22 |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
23 echo "=> Starting WildFly server" |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
24 $JBOSS_HOME/bin/$JBOSS_MODE.sh -c $JBOSS_CONFIG & |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
25 |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
26 echo "=> Waiting for the server to boot" |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
27 wait_for_server |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
28 |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
29 echo "=> Executing the commands" |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
30 $JBOSS_CLI -c --user=admin --password=secret --file=`dirname "$0"`/commands.cli |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
31 |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
32 echo "=> Shutting down WildFly" |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
33 if [ "$JBOSS_MODE" = "standalone" ]; then |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
34 $JBOSS_CLI -c ":shutdown" |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
35 sleep 10 |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
36 echo "=> done." |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
37 else |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
38 $JBOSS_CLI -c "/host=*:shutdown" |
75e87b7d37c0
Add dockerised setup for running the server.
Tom Gottfried <tom@intevation.de>
parents:
diff
changeset
|
39 fi |