Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #!/bin/bash
  2. #
  3. # Script to automate CI deployments. Simply stop all
  4. # servers, change the "current" symlinks to the given
  5. # target folder and finally, start all servers
  6. #
  7.  
  8. play_home="/home/play"
  9. webapps_folder="${play_home}/webapps"
  10. export JAVA_HOME="/usr/lib/jvm/default-java"
  11.  
  12. apps=( "bar" "api" "foo" )
  13.  
  14. for app in ${apps[@]}; do
  15.  
  16.     echo "Stopping server ${app}"
  17.     ${play_home}/bin/${app} stop
  18.  
  19.     echo "Regenerate current symlink of ${app}"
  20.     rm ${webapps_folder}/${app}/current
  21.     ln -s ${webapps_folder}/${app}/${1} ${webapps_folder}/${app}/current
  22.  
  23.     echo "Starting server ${app}"
  24.     ${play_home}/bin/${app} nohup
  25.  
  26. done
  27.  
  28. exit 0