This is in UNIX and Veritas

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"

Who is Participating?
I strongly assume that /oracle/BI1 is a mountpoint, so a "test -d" will always succeed!
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

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

-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.
nice :(
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.