LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices



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

Rep: Reputation: Disabled
How to write init script


Hi,

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.

Regards,
Shahrokh
 
Old 10-24-2005, 01:25 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,790
Blog Entries: 54

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

Original Poster
Rep: Reputation: Disabled
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
 
Old 10-24-2005, 02:54 PM   #4
Orkie
Member
 
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/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).
 
Old 10-24-2005, 04:08 PM   #5
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,455

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


Reply


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 08:04 PM.

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