Find the answer to your Linux question:
Results 1 to 2 of 2
I would like to use a bash script to modernize my bash script for shutting down my jboss applications. the first script is: #!/bin/bash ################################################# ## Stop script for LST ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2010
    Posts
    1

    bash script for shutting down jboss in linux


    I would like to use a bash script to modernize my bash script for shutting down my jboss applications.

    the first script is:
    #!/bin/bash

    #################################################
    ## Stop script for LST - Helpdesk
    ## application.
    #################################################

    export BIND_IP=10.170.28.128
    export INST_HOME=dev.lst-adminops
    export JAVA_HOME=/usr/java/jre1.5.0_14
    export JBOSS_HOME=/dapp032/u01/app/jboss/jboss-4.2.3.GA

    $JBOSS_HOME/bin/shutdown.sh --server=jnp://$BIND_IP:1099 -u jbadmin -p XXXXXX

    What i am trying to do is add a grep and kill command to the script so which will help me automate my shutdown of jboss.

    this is what i have so far: "will be added to the end of the script"

    sleep 30

    PID=`ps ux | grep "org.jboss.Main -c dev.lst-adminops" | grep -v grep | awk '{print $2}'`
    FILE=lstAdminOps.dump

    if [ -z "$PID" ] ; then echo "No PID found." ; fi

    echo "Taking thread dump."
    kill -3 $PID

    echo "Executing jmap on PID $PID"
    $JBOSS_HOME -heap:live,format=b,file=$FILE $PID


    rm -R ../work
    rm -R ../tmp



    But i want to remove the container name dev.lst-adminops and have it grep the actual PID from the application that we are shutting down at that time. That way we can automate it better.
    Please let me know what you think.

    Thanks

  2. #2
    Just Joined! barriehie's Avatar
    Join Date
    Apr 2008
    Location
    The Desert!
    Posts
    85
    Won't
    Code:
    pidof jboss
    return the PID's of the launched apps?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •