-   Programming (
-   -   How to write init script (

shahrokhnikou 10-24-2005 05:39 AM

How to write init script

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.


unSpawn 10-24-2005 01:25 PM


# 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>".

shahrokhnikou 10-24-2005 01:58 PM

Thank you for your reply. If you know weblogic, You would definitely know that there is an script to run weblogic server manually "". 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

Orkie 10-24-2005 02:54 PM

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/"'.
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).

sundialsvcs 10-24-2005 04:08 PM

Incidentally, there's a nearly-duplicate thread running here...

All times are GMT -5. The time now is 04:16 PM.