tom@748: #!/bin/bash tom@748: tom@748: if [ -z $JBOSS_HOME ] tom@748: then tom@748: JBOSS_HOME=/opt/jboss/wildfly tom@748: fi tom@748: JBOSS_CLI=$JBOSS_HOME/bin/jboss-cli.sh tom@748: JBOSS_MODE=${1:-"standalone"} tom@748: JBOSS_CONFIG=${2:-"$JBOSS_MODE.xml"} tom@748: tom@748: function wait_for_server() { tom@748: until `$JBOSS_CLI -c "ls /deployment" &> /dev/stdout`; do tom@748: sleep 1 tom@748: done tom@748: } tom@748: tom@748: function wait_for_shutdown() { tom@748: until `$JBOSS_CLI -c "ls /deployment" &> /dev/stdout`; do tom@748: sleep 1 tom@748: done tom@748: } tom@748: tom@748: echo "=> Starting WildFly server" tom@748: $JBOSS_HOME/bin/$JBOSS_MODE.sh -c $JBOSS_CONFIG & tom@748: tom@748: echo "=> Waiting for the server to boot" tom@748: wait_for_server tom@748: tom@748: echo "=> Executing the commands" tom@748: $JBOSS_CLI -c --user=admin --password=secret --file=`dirname "$0"`/commands.cli tom@748: tom@748: echo "=> Shutting down WildFly" tom@748: if [ "$JBOSS_MODE" = "standalone" ]; then tom@748: $JBOSS_CLI -c ":shutdown" tom@748: sleep 10 tom@748: echo "=> done." tom@748: else tom@748: $JBOSS_CLI -c "/host=*:shutdown" tom@748: fi