Skip to content

Instantly share code, notes, and snippets.

@jaehoo
Created January 15, 2013 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jaehoo/4540736 to your computer and use it in GitHub Desktop.
Save jaehoo/4540736 to your computer and use it in GitHub Desktop.
Script to Manage Jboss Service into SUSE 10 (SLES 10)
#! /bin/sh
export JBOSS_HOME=/usr/share/jboss-6.1.0.Final
start(){
echo "Starting jboss.."
# If using an SELinux system such as RHEL 4, use the command below
# instead of the "su":
# eval "runuser - jboss -c '/opt/jboss/current/bin/run.sh > /dev/null 2> /dev/null &'
# if the 'su -l ...' command fails (the -l flag is not recognized by my su cmd) try:
sudo -u jboss $JBOSS_HOME/bin/run.sh > /dev/null 2> /dev/null &
#Su -l jboss -c '$JBOSS_HOME/bin/run.sh > /dev/null 2> /dev/null &'
}
stop(){
echo "Stopping jboss.."
# If using an SELinux system such as RHEL 4, use the command below
# instead of the "su":
# eval "runuser - jboss -c '/opt/jboss/current/bin/shutdown.sh -S &'
# if the 'su -l ...' command fails try:
sudo -u jboss $JBOSS_HOME/bin/shutdown.sh -S &
#su -l jboss -c '$JBOSS_HOME/bin/shutdown.sh -S &'
}
restart(){
stop
# give stuff some time to stop before we restart
sleep 60
# protect against any services that can't stop before we restart (warning this kills all Java instances running as 'jboss' user)
su -l jboss -c 'killall java'
# if the 'su -l ...' command fails try:
# sudo -u jboss killall java
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo "Usage: jboss {start|stop|restart}"
exit 1
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment