WSO2 auto initialize as daemon linux
How to make WSO2 solutions work as a daemon on linux and make them auto start on the initlization.
the script [WSO2_HOME]/bin/wso2server.sh is already prepared to start the solution as a Daemon, you just have to call it by informing the parameter start or stop.
[WSO2_HOME]/bin/wso2server.sh start
To make it initialize with you OS you must do as follows:
* First you must change [WSO2_HOME]/bin/wso2server.sh, uncomment and set CARBON_HOME, optionally you can set JAVA_HOME, JAVA_OPTS and also PATH like the following example:
JAVA_OPTS=””PATH=”/sbin:/bin:/usr/sbin:/usr/bin”
CARBON_HOME=”/opt/[WSO2_HOME]”
JAVA_HOME=”/opt/jdk1.6.0_27″
* add the INIT INFO header so the script can be added to the /etc/rc#.d/ folders, like the following example.
#!/bin/sh
### BEGIN INIT INFO
# Provides: wso2esb
# Required-Start: $local_fs $remote_fs $network $time
# Required-Stop: $local_fs $remote_fs $network $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 6
# Short-Description: start WSO2 Enterprise Service Bus
### END INIT INFO
* copy the script to /etc/init.d/ removing the extension .sh,(exemplo: wso2esb);
cp [WSO2_HOME]/bin/wso2server.sh /etc.init.d/wso2esb
* then execute
For ubuntu: sudo update-rc.d –f wso2esb defaults
For centos: sudo chkconfig –add wso2esb
sudo chkconfig wso2esb on
*This solution applies to WSO2 ESB (Enterprise Service Bus), GREG (Governance Registry), IS (Identity Server), AS(Application Server), ELB (Elastic Load Balancer) and probably all solutions made using WSO2 Carbon.