5 Replies Latest reply on Feb 11, 2010 5:03 PM by Ed Larkin

    Scripting with SSH and jboss startup

    Ed Larkin Newbie

      hello,

       

      I am working on an automated build project right now that involves a single build server and multiple app servers, on the build server I am running a script to start/stop jboss, check out code, compile, deploy ears, copy files.

       

      I am currently running some scripts with ssh and they are all working fine except for the startup script:

       

      On the build server I call:

      ssh user@$SERVER '/home/user/scripts/build/startem.sh'

       

      here is the startem.sh script on the local machine:

      #!/bin/bash

      JAVA_HOME="/opt/jdk"

      export JAVA_HOME

      JBOSS_HOME=/opt/jboss/

      export JBOSS_HOME

      /home/user/scripts/startservera.sh &

      sleep 15

      /home/mdfuser/scripts/startserverb.sh &

      exit

       

      Here is the startservera.sh startserverb.sh is identical except -c and its NODE2 not NODE1

      DMFCODE=NODE1_QA

      $JBOSS_HOME/bin/run.sh -b 0.0.0.0 -c servernamea -DMDFJVM=$DMFCODE other options here > ~/logs/server.log &

      The problem is servera will startup, then serverb will startup but it never exits, so the ssh commands stays open and never finishes on the build server.
      I have placed exits all over the place and none of them will escape the ssh command. I have a feeling it is the backgrounding ampersand in the startup script.
      Anyone have any suggestions on how background without an ampersand? or possibly bypass this problem?
      Thanks,
      Ed