Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # -------------------------------------------------------------------------
- # Deploy script for Linux (Remote access for a Domain controller)
- #
- # Use deploy.sh [minimal] [host:port] [username] [password]
- #
- # -------------------------------------------------------------------------
- SERVER_GROUP=xxx
- HOST=${2:-localhost:9990}
- if [[ ! "$3" = "" ]]; then
- AUTH="--user=$3 --password=$4 --error-on-interact"
- fi
- # !!!Equal sign should by escaped with 2 backslashes in DB_URL!!!
- ENV_VARIABLES="-DSERVER_GROUP=$SERVER_GROUP -DDB_URL=$DB_URL -DDB_USER=$DB_USER -DDB_PASSWORD=$DB_PASSWORD"
- LOGFILE=log.txt
- ERRORSFILE=error.txt
- echo Stopping WildFly servers
- java -jar jboss-cli.jar $AUTH --controller=$HOST --connect --command="/server-group=$SERVER_GROUP:stop-servers(blocking=true)"
- if [[ "$1" = "minimal" ]]; then
- echo Redeploy applications minimal online
- java $ENV_VARIABLES -jar jboss-cli.jar $AUTH --controller=$HOST --connect --echo-command --file=application.cli-minimal >$LOGFILE
- else
- echo Configuring WildFly online
- cat *.cli >>online-batch
- java $ENV_VARIABLES -jar jboss-cli.jar $AUTH --controller=$HOST --connect --echo-command --file=online-batch >$LOGFILE
- fi
- if grep "doesn't exist\|\"outcome\" => \"failed\"\|Failed to connect to the controller\|Operation failed\|is not a valid node type name" $LOGFILE >$ERRORSFILE; then
- echo Deployment failed. See details in $LOGFILE
- cat $ERRORSFILE
- exit 5
- fi
- echo Starting WildFly servers
- java -jar jboss-cli.jar $AUTH --controller=$HOST --connect --command="/server-group=$SERVER_GROUP:start-servers(start-mode=normal)"
- echo Deployment finished
Add Comment
Please, Sign In to add comment