Last active
December 14, 2015 16:29
-
-
Save fatmcgav/5115394 to your computer and use it in GitHub Desktop.
Oracle Clones fact
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get a list of running dbs... | |
running_dbs = Facter::Util::Resolution.exec("ps -ef |grep [o]ra_pmon |awk {'print $8'} |awk 'BEGIN{FS=\"_\";} {print $3}'") | |
unless running_dbs.nil? or running_dbs.empty? | |
running_dbs.each do |db| | |
if (db =~ /REPC/) | |
# Need to get the export path | |
mount_point = Facter::Util::Resolution.exec("grep #{db} /etc/fstab | awk {'print $1'}") | |
# Add fact | |
Facter.add("clone_#{db}") do | |
setcode { mount_point } | |
end | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment