Solved

I would like to add an /etc/init.d script to strart Wbsphere

Posted on 2010-08-26
12
871 Views
Last Modified: 2013-12-11
I would like to execute the command to start WPS automatically on start up rather than have to do it manually. IBM support says I can do this as an init.d script......problem is I don't know how to create an /etc/init.d script.

This is the start command (below): How do I make sure this runs on start up? This is a Redhat5 Linux OS.

/opt/IBM/WebSphere/AppServer/bin/startServer.sh server1
0
Comment
Question by:Christopher Schene
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 3
12 Comments
 
LVL 40

Expert Comment

by:omarfarid
ID: 33534185
can you run the command below and post results

who -r

then I will provide you with how to do it
0
 

Author Comment

by:Christopher Schene
ID: 33536997
run-level 5  2010-08-17 16:09                   last=S
0
 
LVL 40

Accepted Solution

by:
omarfarid earned 250 total points
ID: 33537074
you should have a dir /etc/rc5.d

under this dir create the startup script e.g.

S99myscript

which contains all commands necessary to startup WPS

the script should have all necessary env variables set in it, plus it should be executable.

Note that the script name should start S
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 34

Assisted Solution

by:Duncan Roe
Duncan Roe earned 250 total points
ID: 33537218
Have you actually got the file /etc/init.d? Some distributions are doing start-up differently nowadays, that's why I ask. And do you have a script that can start and stop WebSphere?
Does /opt/IBM/WebSphere/AppServer/bin/startServer.sh server1 return you to the command prompt? Assuming it does, you could put

ws1:5:wait:/opt/IBM/WebSphere/AppServer/bin/startServer.sh server1

as a line in /etc/inittab. The colon-separated fields function as follows:

1. ws1 - task identifier. Must be unique. You could put ws2 if starting a second server as server2 for example
2. 5 - run level(s) at which to perform command. String of digits in general, but you only want one
3. wait - how the init process should run your command. wait tells it to wait until the command terminates
4. your command to start WS
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 33537270
2 solutions there - omarfarid's is for a script that accepts start, stoprestart as arguments which your script apparently doesn't do. In that case, WS will get stopped at shut-down when init kills everything, but it won't get stopped otherwise.
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 33537308
Actually I think omarfarid expects you to write a script containing a reference to startServer.sh - that should work fine. Setting environment variables may be necessary also. But because IBM supplied the script, I rather imagine they might be doing that for you already, in which case it will work to invoke it directly as I posted
0
 

Author Comment

by:Christopher Schene
ID: 33561127
Hi...I am setting up a VM to test this in....stand by
0
 

Author Comment

by:Christopher Schene
ID: 33571015
I used this command to configure and I grabbed a script from another websphere server....it starts up OK, but does not stop when I am rebooting

./wasservice.sh -add "WebSphere_Portal" -serverName "WebSphere_Portal" -profilePath "/opt/IBM/WebSphere/wp_profile" -wasHome "/opt/IBM/WebSphere/AppServer" -configRoot "/opt/IBM/WebSphere/wp_profile/config" –logRoot "/opt/IBM/WebSphere/wp_profile/logs/WebSphere_Portal" –stopArgs “-username wpsadmin –password wpsadmin” -startType automatic
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 33571463
how the script is created under /etc/rc5.d directory? what are the permissions of the file? does the file name starts with S ? does it include all required env. variables?
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 33572113
If you put this directly into inittab, init will stop it if it is still running (and you invoked it with "&" at the end). You need to modify the script(s) involved so they don't start another job and return in that case.
If you went the rc.5 route, you have an S script there to start it and you need a K script in all the other rc  directories to stop it. Usually they are all symbolic links to the same script, but S & K could be different
0
 

Author Comment

by:Christopher Schene
ID: 33582532
I did this, but in /etc/init.d rather than /etc/rc5.d and I noticed that there are links in /etc/rc5.d  to the elements in /etc/init.d.



you should have a dir /etc/rc5.d

under this dir create the startup script e.g.

S99myscript

which contains all commands necessary to startup WPS

the script should have all necessary env variables set in it, plus it should be executable.

Note that the script name should start S
etc-rc5.d.png
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 33585353
/etc/rc5.d looks perfectly normal. The S files are invoked with the argument start and the K files are invoked with the argument stop, when run level 5 is entered. It is indeed more common to use this system than to invoke commands from init.d directly. If your scripting is up to it, you could write a little script of your own which accepts start, stop & restart:-

start invokes the command you already use
stop invokes some command that will stop Websphere (you will have to find that command)
restart invokes stop followed by start

place that script in init.d and make S & K symbolic links to it. Make he S number large, so it will be started close to last (unless you have a reason to start it early) and make the K number small to stop early (unless ... ). Place S link in rc5.d and a K link in all the other rc<n>.d directories.

Or leave it as it is and live with it
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Clonezilla doesn't restore from image 12 135
iptables limit connection per ip correct way ? 2 297
Encrypted Laptop running Linux 3 138
Linux Scripting 3 187
In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question