Thursday, January 28, 2016

Configure WSO2 server to start automatically after reboot

I have tested following within a RHEL box, but with a slight modification to the run-level, same script can be used within other Linux distros.

Assume we have WSO2 DAS server within /carbon/wso2/das directory and JDK installed in /carbon/java/ directory. Make sure to update these two according to your environment.

 1. Copy following startup-script to the /etc/init.d directory.
 2. Execute chmod a+x and a+r on the script.
 3. Set run level using "sudo chkconfig dasserver on"
 4. Recheck above using "chkconfig --list dasserver" This should output ,
 "dasserver       0:off   1:off   2:on    3:on    4:on    5:on    6:off"
Startup script
#! /bin/sh
#
# dasserver          Start up the WSO2 DAS server
#
# chkconfig: 2345 55 25
# description: WSO2 Data Analytics Server is a comprehensive enterprise data analytics platform.

export JAVA_HOME="/carbon/java/jdk1.8.0_65"


startcmd='/carbon/wso2/das/
wso2das-3.0.0/bin/wso2server.sh start > /dev/null &'
restartcmd='/carbon/wso2/das/
wso2das-3.0.0/bin/wso2server.sh restart > /dev/null &'
stopcmd='/carbon/wso2/das/
wso2das-3.0.0/bin/wso2server.sh stop > /dev/null &'

case "$1" in
start)
   echo "Starting the WSO2 DAS Server ..."
   su -c "${startcmd}" wso2usr
;;
restart)
   echo "Re-starting the WSO2 DAS Server ..."
   su -c "${restartcmd}" wso2usr
;;
stop)
   echo "Stopping the WSO2 DAS Server ..."
   su -c "${stopcmd}" wso2usr
;;
*)
   echo "Usage: $0 {start|stop|restart}"
exit 1
esac

No comments:

Post a Comment