Go Job Hunting at the LQ Job Marketplace
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-24-2005, 05:39 AM   #1
LQ Newbie
Registered: Jul 2005
Location: Finland
Posts: 11

Rep: Reputation: Disabled
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.

Old 10-24-2005, 01:25 PM   #2
Registered: May 2001
Posts: 28,886
Blog Entries: 55

Rep: Reputation: 3356Reputation: 3356Reputation: 3356Reputation: 3356Reputation: 3356Reputation: 3356Reputation: 3356Reputation: 3356Reputation: 3356Reputation: 3356Reputation: 3356
# 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>".
Old 10-24-2005, 01:58 PM   #3
LQ Newbie
Registered: Jul 2005
Location: Finland
Posts: 11

Original Poster
Rep: Reputation: Disabled
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
Old 10-24-2005, 02:54 PM   #4
Registered: Mar 2005
Distribution: Breezy Badger
Posts: 248

Rep: Reputation: 30
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).
Old 10-24-2005, 04:08 PM   #5
LQ Guru
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,980

Rep: Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441Reputation: 1441
Incidentally, there's a nearly-duplicate thread running here...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
INIT stops at remount of root in read-write mode cs30109 Linux - Newbie 0 01-29-2005 07:11 PM
can't get my init script working nukeu666 Linux - Newbie 4 12-16-2004 12:12 PM
help with init script output ierickson Linux - General 0 05-07-2004 01:05 PM
How to add something in init script Ypkis Linux - Newbie 5 10-12-2003 07:35 AM
could use some help with my init.d script.... BrianK Linux - General 3 10-31-2002 08:21 PM

All times are GMT -5. The time now is 07:35 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration