Unix
Application Server as a Service in Unix
Running the Application Server as a service or daemon on the machine ensures that service restart automatically when the machine reboots and also provides the capability to start the server with a UNIX shell.
In this post, we will create Weblogic server as a service making it to start at machine reboot in few steps as follows:
Step 1: Create a file to configure the init script with name weblogic inside directory /etc/default/ with content, as follows:
01 02 03 04 05 06 07 08 09 10 11 | # /etc/default/weblogic script used to configure the init script # Weblogic Server installation home directory WLSHOME= "/opt/weblogic/wlserver_10.3" # Weblogic Server sample server SAMPLESERVER= "/samples/domains/wl_server" # Username password for stopping USER= "weblogic" PASSWORD= "welcome1" |
Step 2: Create a file with name weblogic inside directory /etc/init.d/ with content, as follows:
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #!/bin/sh . /etc/default/weblogic start() { ${WLSHOME}${SAMPLESERVER} /bin/startWebLogic .sh & } stop() { ${WLSHOME}${SAMPLESERVER} /bin/stopWebLogic .sh -username ${USER} -password ${PASSWORD} & } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac |
Step 3: Make weblogic file inside directory /etc/init.d/ as executable
1 2 | $ cd /etc/init .d/ $ chmod +x weblogic |
Step 4: Add the service to the automatic startup system.
1 | $ sudo update-rc.d weblogic defaults |
Reference: | Application Server as a Service in Unix from our SCG partner Arpit Aggarwal at the Arpit Aggarwal blog. |
Good tip Arpit.