This is in UNIX and Veritas

Posted on 2011-03-20
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/ 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"

Question by:aixtutorial
  • 3
  • 2

Expert Comment

ID: 35176774
while true
do [[ -d /oracle/BI1 ]] && \
      { /oracle/BI/1setup/
        [[ $ret = 0 ]] && mail -s "`hostname`: startrunsaw success"
        [[ $ret != 0 ]] && mail -s "`hostname`: startrunsaw not successful ($ret)"
      sleep 60
LVL 68

Expert Comment

ID: 35176791

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/ ]
    if ! ps -ef | grep -v grep | grep "runsaw"
         nohup /oracle/BI/1setup/ &
         echo "New file system found and the application has been restarted" | mailx -s "Application Restart on Server $(hostname)" aixtutorial@domain.tld

LVL 68

Accepted Solution

woolmilkporc earned 250 total points
ID: 35176799
I strongly assume that /oracle/BI1 is a mountpoint, so a "test -d" will always succeed!

Expert Comment

ID: 35176853
-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 file... or using the ps cmd.

Expert Comment

ID: 35479458
nice :(

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

911 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

19 Experts available now in Live!

Get 1:1 Help Now