Recent releases of Ubuntu & RedHat both support Upstart which is a new way to automatically turn programs into daemons so you are able execute them on system start-up. I tried to make my Weblogic domain start automatically on a development Ubuntu server and this is the result.
It only required me to create a few configuration files.
Ubuntu:
For Ubuntu 14.04 the following config files should be placed:
/etc/init/ofmw_admin.conf
start on runlevel [2345] exec start-stop-daemon --start -u ubuntu -c ubuntu:ubuntu --exec /opt/oracle/config/domains/rbx_dev/bin/startWebLogic.sh
/etc/init/ofmw_nodemgr.conf
start on runlevel [2345] exec start-stop-daemon --start -u ubuntu -c ubuntu:ubuntu --exec /opt/oracle/config/domains/rbx_dev/nodemanager/startNodeManager.sh
And for each 1-n managed server: /etc/init/ofmw_<managedserver>.conf
start on runlevel [2345] exec start-stop-daemon --start -u ubuntu -c ubuntu:ubuntu --exec /opt/oracle/config/domains/rbx_dev/bin/startManagedWebLogic.sh soa_server1
RedHat:
RedHat works a little bit different. I couldn’t test it, but it is explained here by Fusion Security:
/etc/init/ofmw_admin.conf
start on runlevel [345] exec /bin/su - oracle -- /opt/oracle/config/domains/rbx_dev/bin/startWebLogic.sh
/etc/init/ofmw_nodemgr.conf
start on runlevel [345] exec /bin/su - oracle --/opt/oracle/config/domains/rbx_dev/nodemanager/startNodeManager.sh
And for each 1-n managed server: /etc/init/ofmw_<managedserver>.conf
start on runlevel [345] exec /bin/su - oracle -- /opt/oracle/config/domains/rbx_dev/bin/startManagedWebLogic.sh soa_server1
Commands
With the following commands I’m now able to start, stop and get the status of my daemon:
[ubuntu@rbxdev]# start ofmw_bamserver1 ofmw_bamserver1 start/running, process 9464 [ubuntu@rbxdev]# status ofmw_bamserver1 ofmw_bamserver1 start/running, process 9464 [ubuntu@rbxdev]# stop ofmw_bamserver1 ofmw_bamserver1 stop/waiting
references:
- Wikipedia: Upstart
- Fusion Security: Starting and stopping WebLogic automatically using Upstart
Updates:
- 2015-12-08: Added nodemanager configuration