[jboss-user] [Beginner's Corner] - jboss autostart script

gasper jeric do-not-reply at jboss.com
Mon Aug 13 15:12:28 EDT 2012


gasper jeric [https://community.jboss.org/people/gjerich] created the discussion

"jboss autostart script"

To view the discussion, visit: https://community.jboss.org/message/753403#753403

--------------------------------------------------------------
hello
this maybe help someone. I modified ex jboss_init_redhat.sh script to work it for jboss 7.1

#!/bin/sh
#jboss home
JBOSS_HOME=${JBOSS_HOME:-"/opt/jboss"}
#make sure java is in your path
JAVAPTH=${JAVAPTH:-"/usr/local/jdk/bin"}
#define the classpath for the shutdown class
JBOSSCP=${JBOSSCP:-"$JBOSS_HOME/bin/jboss-cli.sh --connect command=:shutdown"}
#define the script to use to start jboss
JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/standalone.sh"}
#define what will be done with the console log
JBOSS_CONSOLE=${JBOSS_CONSOLE:-"/dev/null"}

JBOSS_CMD_START="cd $JBOSS_HOME/bin; $JBOSSSH"
JBOSS_CMD_STOP=${JBOSS_CMD_STOP:-"$JBOSSCP"}

if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then
  export PATH=$PATH:$JAVAPTH
fi

if [ ! -d "$JBOSS_HOME" ]; then
  echo JBOSS_HOME does not exist as a valid directory : $JBOSS_HOME
  exit 1
fi

#echo JBOSS_CMD_START = $JBOSS_CMD_START

case "$1" in
start)
    cd $JBOSS_HOME/bin & echo starting...
    if [ -z "$SUBIT" ]; then
        eval $JBOSS_CMD_START >${JBOSS_CONSOLE} 2>&1 &
    else
        $SUBIT "$JBOSS_CMD_START >${JBOSS_CONSOLE} 2>&1 &" 
    fi
    ;;
stop)
    if [ -z "$SUBIT" ]; then
        $JBOSS_CMD_STOP & echo stopping...
    else
        $SUBIT "$JBOSS_CMD_STOP"
    fi 
    ;;
restart)
    $0 stop
    $0 start
    ;;
*)
    echo "usage: $0 (start|stop|restart|help)"
esac


*usage*:

* sudo service jboss start
* sudo service jboss stop
* sudo service jboss restart

or this way:

* sudo /etc/init.d/jboss start
* sudo /etc/init.d/jboss stop
* sudo /etc/init.d/jboss restart


all comments apreciated
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/753403#753403]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120813/c5417341/attachment-0001.html 


More information about the jboss-user mailing list