Difference between revisions of "Configure JBoss service"
From OpenKM Documentation
(Created page with 'For security reasons you shouldn't run JBoss as '''root'''. It is better to create an user named openkm and run JBoss from him: $ adduser openkm Create a file with the script:…') |
|||
Line 46: | Line 46: | ||
exit 1 | exit 1 | ||
esac | esac | ||
+ | exit 0 | ||
+ | </source> | ||
+ | |||
+ | And make it executable: | ||
+ | |||
+ | $ chmod 755 /etc/init.d/jboss | ||
+ | |||
+ | Now update the run-levels: | ||
+ | |||
+ | $ update-rc.d jboss defaults | ||
− | + | Also is a good idea to configure JBoss memory utilization. Edit the file ''$JBOSS_HOME/bin/run.sh'' and add a new parameter '''JAVA_OPTS''' where you can increase the system memory managed by the JVM (Java Virtual Machine): | |
+ | |||
+ | <source lang="bash" highlight="4"> | ||
+ | DIRNAME=`dirname $0` | ||
+ | PROGNAME=`basename $0` | ||
+ | GREP="grep" | ||
+ | JAVA_OPTS="-Xmx1744m -XX:MaxPermSize=256m" | ||
</source> | </source> | ||
+ | |||
+ | This example is for a system with 2 GB of RAM. | ||
+ | |||
+ | For more info, read http://jboss.org/community/docs/DOC-11566. |
Revision as of 18:20, 21 January 2010
For security reasons you shouldn't run JBoss as root. It is better to create an user named openkm and run JBoss from him:
$ adduser openkm
Create a file with the script:
$ vim /etc/init.d/jboss
#!/bin/sh
# /etc/init.d/jboss: Start and stop JBoss AS
ECHO=/bin/echo
TEST=/usr/bin/test
JBOSS_START_SCRIPT=/home/openkm/jboss-4.2.2.GA/bin/run.sh
JBOSS_STOP_SCRIPT=/home/openkm/jboss-4.2.2.GA/bin/shutdown.sh
$TEST -x $JBOSS_START_SCRIPT || exit 0
$TEST -x $JBOSS_STOP_SCRIPT || exit 0
start() {
$ECHO -n "Starting JBoss"
su - openkm -c "$JBOSS_START_SCRIPT -b 0.0.0.0 > /dev/null 2> /dev/null &"
$ECHO "."
}
stop() {
$ECHO -n "Stopping JBoss"
su - openkm -c "$JBOSS_STOP_SCRIPT -S > /dev/null &"
$ECHO "."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 30
start
;;
*)
$ECHO "Usage: jboss {start|stop|restart}"
exit 1
esac
exit 0
And make it executable:
$ chmod 755 /etc/init.d/jboss
Now update the run-levels:
$ update-rc.d jboss defaults
Also is a good idea to configure JBoss memory utilization. Edit the file $JBOSS_HOME/bin/run.sh and add a new parameter JAVA_OPTS where you can increase the system memory managed by the JVM (Java Virtual Machine):
DIRNAME=`dirname $0`
PROGNAME=`basename $0`
GREP="grep"
JAVA_OPTS="-Xmx1744m -XX:MaxPermSize=256m"
This example is for a system with 2 GB of RAM.
For more info, read http://jboss.org/community/docs/DOC-11566.