LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 11-09-2010, 10:39 AM   #1
dnaqvi
Member
 
Registered: Oct 2009
Posts: 117

Rep: Reputation: 15
start stop portal 1 and portal 2


Hello All,

We have multiple servers.
WebSphere Portal is running on the servers.
Node 1 portals are called WebSphere_Portal and node portals are called WebSphere_Portal_2.
We want same script to start and stop portal in all environments.

I am getting following errror message

: No such file or directory1: !/bin/bash
'/WebPortalUptest.sh: line 24: syntax error near unexpected token `in
'/WebPortalUptest.sh: line 24: `case $host in

here is the Script:

Code:
#!/bin/bash
host=$(hostname)
dt=$(date +'%D %T')
logfile='PortalUp.log'
profile_path='/opt/IBM/WebSphere/wp_profile'
server_name='WebSphere_Portal'
#
echo "*****************************WebSphere*Application*Start-Up*Log*********************************" > /tmp/weblog/$logfile
# check if pid file exists. yes, server is started and exit. no, execute a start server command in background
if [ -f $profile_path/logs/$server_name/$server_name.pid ]; then
  echo $dt $server_name on $host Server has seen started. >> /tmp/weblog/$logfile
  exit
else
case $host in
prtltst5|prtlprd5|prtlstg5|wcmprd5|wcmstg5|prtldev2)
                 $profile_path/bin/startServer.sh WebSphere_Portal;;
prtltst6|prtlprd6|prtlstg6|wcmprd6)
                $profile_path/bin/startServer.sh WebSphere_Portal_2;;
*) ;;
  echo $dt start command for $server_name on $host Server has been issued. >> /tmp/weblog/$logfile
fi
# check every 3 minutes to see if server has been started. if server does not start in 30 minutes (10 checks), exit the script with
# return code 8
let "count = 0"
while [ $count -lt 11 ]
  do
    let "count = count +1"
#
    dt=$(date +'%D %T')
#
    if [ -f $profile_path/logs/$server_name/$server_name.pid ]; then
      echo $dt $server_name on $host server has been successfully started. >> /tmp/weblog/$logfile
      exit
#
    else
      echo $dt start process for $server_name on $host server is still running. checked $count times, 3 minutes apart >> /tmp/weblog/$logfile
      sleep 180
    fi
#
  done
#
dt=$(date +'%D %T')
echo $dt start process for $server_name on $host server DID NOT complete successfully. checked $count times, 3 minutes apart >> /tmp/weblog/$logfile
exit 8
Thanks

Last edited by dnaqvi; 11-10-2010 at 06:22 PM.
 
Old 11-09-2010, 06:00 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
shebang is wrong

First line of the script may be causing a problem:
Code:
!/bin/bash
should be:
Code:
#!/bin/bash
Not sure if anything else is wrong, and it is very hard to examine the code when you do not use Code Tags, so if you would edit your post and add code tags, it'll be easier to help if there are more problems with the script.
 
Old 11-09-2010, 06:39 PM   #3
dnaqvi
Member
 
Registered: Oct 2009
Posts: 117

Original Poster
Rep: Reputation: 15
I edited
 
Old 11-09-2010, 06:59 PM   #4
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
OK, and did you try to run the script again? Does it work? I do not see an esac statement to close the case statement, but then, there appears to be something strange about how you put your code tags around the program. That is all one script is it not? How come it is divided up between code and not-code tags?
 
Old 11-10-2010, 05:30 PM   #5
dnaqvi
Member
 
Registered: Oct 2009
Posts: 117

Original Poster
Rep: Reputation: 15
Can I email to you code?

Can I email to you code? my email id is
bobwoolmerjr@gmail.com

Last edited by dnaqvi; 11-10-2010 at 05:32 PM.
 
Old 11-10-2010, 05:33 PM   #6
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Whatever for? There's no need to. Just fix it per as has been suggested already, and try it again. If it doesn't work, show us (copy + paste from your terminal to your next post) what happens when you run it. Include any error messages.. And post the script here again if need be - but try to get the whole script inside one set of code tags
 
Old 11-30-2010, 12:15 PM   #7
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
You're missing the esac for your case.
 
  


Reply



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
"Adjusting Startup Script To Start Multiple Portal Servers dnaqvi Programming 9 09-30-2010 12:10 PM
portal server Ammad Linux - General 1 05-26-2007 02:10 PM
Portal Linux_BSD_Unix General 1 09-24-2006 11:55 PM
how to create a portal? tsitras Debian 1 08-05-2004 07:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:46 AM.

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
Open Source Consulting | Domain Registration