Solved

This is in UNIX and Veritas

Posted on 2011-03-20
5
174 Views
Last Modified: 2012-05-11
This is in   AIX UNIX and VCS..We are using VCS for the file system failover to other server when the server crashes..We have used the script in VCS to start the  application but the application goes down for some reason if VCS uses scripts to start up so we have removed the scripts from VCS so only the filesystems are now under VCS for failover

I need a script on the other server when it sees a new fileystem it should start the application..I want to set up a script on server 2 which is abcxyz02 as soonn as it sees the filesystem /oracle/BI1 its should run this script which wil bring up the application  /oracle/BI/1setup/startrunsaw.sh..and as soon as the application is restarted I want an e-mail to be sent from the server saying "New file system found and the application has been restarted"



0
Comment
Question by:aixtutorial
  • 3
  • 2
5 Comments
 
LVL 5

Expert Comment

by:paulqna
Comment Utility
#!/bin/ksh
while true
do [[ -d /oracle/BI1 ]] && \
      { /oracle/BI/1setup/startrunsaw.sh
        ret=$?
        [[ $ret = 0 ]] && mail -s "`hostname`: startrunsaw success" user@domain.com
        [[ $ret != 0 ]] && mail -s "`hostname`: startrunsaw not successful ($ret)" user@domain.com
      }
      sleep 60
done
0
 
LVL 68

Expert Comment

by:woolmilkporc
Comment Utility
Hi,

we must test if the application is already running, else it will be
restarted every time the script runs!

Unless you provide a better method how to do this I will use "ps":

if [ -x /oracle/BI/1setup/startrunsaw.sh ]
   then
    if ! ps -ef | grep -v grep | grep "runsaw"
       then
         nohup /oracle/BI/1setup/startrunsaw.sh &
         echo "New file system found and the application has been restarted" | mailx -s "Application Restart on Server $(hostname)" aixtutorial@domain.tld
    fi
fi

wmp
         
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 250 total points
Comment Utility
I strongly assume that /oracle/BI1 is a mountpoint, so a "test -d" will always succeed!
0
 
LVL 5

Expert Comment

by:paulqna
Comment Utility
-d was just a suggestion, any test for existing files/dirs under that mountpoint will do, and it needs to run permanently with a sleep of x seconds or as a cronjob running ever x minutes.

The self-run-check is good to include also, so he should take the best ideas from both of us.
The self-run-check could be included in the startrunsaw script also. for example with a startrunsaw.pid file... or using the ps cmd.
0
 
LVL 5

Expert Comment

by:paulqna
Comment Utility
nice :(
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Suggested Solutions

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now