ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How can I write an init script in order to be able to run weblogic server at startup.
My question is related to weblogic version 8.1.4, Is there anyway to start admin server at boot time by using an init script. precisely I mean in need to know how can I write an script and run it as service in run level 3, I'm using redhat os.
I'll be very much appreciate if someone can solve my problem.
I'm not a programmer though.
#!/bin/bash
#
# server Server
# chkconfig: 99 01 01
# description: Startup script server
# Source function library.
. /etc/init.d/functions
start_cmd="/usr/bin/java start ./server etc etc"
stop_cmd="pkill -KILL -f /usr/bin/java start ./server etc etc"
dispExit() { case $1 in 0) echo_success;; *) echo_failure;; esac; }
case "$1" in
start) $start_cmd; dispExit $?;;
stop) $stop_cmd; dispExit $?;;
restart) $0 stop; $0 start;;
esac; exit 0
Change start_cmd="" to how you start the server. If you need to set variables just add the declarations above the start_cmd= line. Change stop_cmd="pkill -KILL -f " to how you kill the server. If you use "pkill -f" to find the right PID, try to find the string using "pgrep -lf </path/path/name args>".
Hi,
Thank you for your reply. If you know weblogic, You would definitely know that there is an script to run weblogic server manually "startWebLogic.sh". Do you think can I somehow use this script or I should follow what you mentioned in your previous message, As I'm very new in linux and weblogic I barely understood what should I do
? So can you explain it somehow that I can understand?
I guess that command you mentioned it was for Windows OS, I have linux, I think I should use command where ending is .sh
All of those commands are for Linux. In that above code, you need to save it in the correct place (your other thread said where and what to save it as) then run 'chmod +x' on it.
You need to replace the 'start_cmd="/usr/bin/java start ./server etc etc"' to 'start_cmd="/path/to/startWebLogic.sh"'.
Linux commands don't have a single standard ending like Windows does (Windows uses .exe, normally on Linux, program files have no ending at all).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.