Re: Run a script automatically when an IP is added

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Try this:

1. create an application vips, this app moves with your VIPS (see appvipcfg)
2. create a profile which has an action_script=your_script.sh and
start/stop_dependencies=hard(previous_vipappname)
your _script must contains start, stop. Put the script you want to run.
3. add a resource -type= cluster_resource -file previous_profile_script.
(crsctl add resource -type cluster_resource -f your_profile_script)

Other solution:

http://docs.oracle.com/cd/E11882_01/rac.112/e17264/configwlm.htm#TDPRC296

About FAN Callouts

FAN callouts are server-side executable files that Oracle RAC runs
immediately when high availability events occur. A callout is essentially a
shell script or precompiled executable written in any programming language.
Some examples of how you can use FAN callouts to automate the actions
performed when events occur in a cluster configuration are as follows:

   -

   Starting and stopping server-side applications
   -

   Relocating low-priority services when high-priority services come online
   -

   Sending text or numeric messages to pagers
   -

   Executing shell scripts

The executable files for FAN callouts are stored in the
Grid_home/racg/usrco subdirectory.
If this subdirectory does not exist in your Grid home, then you must create
this directory with the same permissions and ownership as the Grid_home/
racg/tmp subdirectory.

All executables in the Grid_home/racg/usrco subdirectory are executed
immediately, in an asynchronous fashion, when a FAN event received through
the ONS. A copy of the executable files used by FAN callouts should be
available on every node that runs Oracle Clusterware. Example callout
scripts are available on Oracle Technology Network at
http://www.oracle.com/technetwork/database/enterprise-edition/twpracwkldmgmt-132994.pdf


Regards,

Pedro




2014-08-28 0:47 GMT+02:00 Cameron Simpson <cs@xxxxxxxxxx>:

> On 26Aug2014 09:37, Yong Huang <yong321@xxxxxxxxx> wrote:
>
>> Oracle's clusterware can migrate a VIP from one server to another. I'd
>> like to have the target server automatically run a shell script once the
>> new IP comes in. Is there a way to detect that and trigger execution of
>> this script?
>>
>> This
>> http://www.diglinux.com/2012/04/07/linux-heartbeat-ip-fail-over-2/
>> looks like what I need. But I wonder if a simpler solution exists,
>> preferably without installing extra package. In fact, yum install heartbeat
>> on my Red Hat box didn't find the package.
>>
>
> Since nobody has replied, this is something you can do yourself with a
> little script. As a starting point, this lists all the IPv4 addresses on my
> host (current OSX, but adjusting for Linux "ifconfig" output should be
> easy):
>
>   ifconfig -a | sed -n 's/^ inet \([1-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)
> .*/\1/p'
>
> Note that the first whitespace before "inet" is a TAB character.
>
> Have a look at "ifconfig -a" on your system and adjust the regexp.
>
> (Or, if you care only about a specific interface, use "ifconfig eth0" or
> whatever to monitor just that interface.)
>
> Then all you would do is run that, pipe it through "sort -u", and put the
> output in a file.
>
> Next time, run it, sort, put in a temp file.
>
> Compare them ("cmp -13 old-file tmp-file" should be useful) to get a list
> of new IP addresses. When you get a new one, do what you want. Save the
> tmp-file to the old-file for use on the next run.
>
> Put it in cron to run regularly.
>
> Cheers,
> Cameron Simpson <cs@xxxxxxxxxx>
>
> WFO: the normal throttle position for Denizens, squids, and unfortunates on
>      50cc Honda step-throughs.
>
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list
>
-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list




[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux