Guest User

Untitled

a guest
Jul 16th, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. #!/bin/bash
  2. # -------------------------------------------------------------------------
  3. # Deploy script for Linux (Remote access for a Domain controller)
  4. #
  5. # Use deploy.sh [minimal] [host:port] [username] [password]
  6. #
  7. # -------------------------------------------------------------------------
  8.  
  9. SERVER_GROUP=xxx
  10. HOST=${2:-localhost:9990}
  11. if [[ ! "$3" = "" ]]; then
  12. AUTH="--user=$3 --password=$4 --error-on-interact"
  13. fi
  14.  
  15. # !!!Equal sign should by escaped with 2 backslashes in DB_URL!!!
  16. ENV_VARIABLES="-DSERVER_GROUP=$SERVER_GROUP -DDB_URL=$DB_URL -DDB_USER=$DB_USER -DDB_PASSWORD=$DB_PASSWORD"
  17.  
  18. LOGFILE=log.txt
  19. ERRORSFILE=error.txt
  20.  
  21. echo Stopping WildFly servers
  22. java -jar jboss-cli.jar $AUTH --controller=$HOST --connect --command="/server-group=$SERVER_GROUP:stop-servers(blocking=true)"
  23.  
  24. if [[ "$1" = "minimal" ]]; then
  25. echo Redeploy applications minimal online
  26. java $ENV_VARIABLES -jar jboss-cli.jar $AUTH --controller=$HOST --connect --echo-command --file=application.cli-minimal >$LOGFILE
  27. else
  28. echo Configuring WildFly online
  29. cat *.cli >>online-batch
  30. java $ENV_VARIABLES -jar jboss-cli.jar $AUTH --controller=$HOST --connect --echo-command --file=online-batch >$LOGFILE
  31. fi
  32.  
  33. 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
  34. echo Deployment failed. See details in $LOGFILE
  35. cat $ERRORSFILE
  36. exit 5
  37. fi
  38.  
  39. echo Starting WildFly servers
  40. java -jar jboss-cli.jar $AUTH --controller=$HOST --connect --command="/server-group=$SERVER_GROUP:start-servers(start-mode=normal)"
  41.  
  42. echo Deployment finished
Add Comment
Please, Sign In to add comment