Skip to content

Instantly share code, notes, and snippets.

@fatmcgav
Last active December 14, 2015 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fatmcgav/5115394 to your computer and use it in GitHub Desktop.
Save fatmcgav/5115394 to your computer and use it in GitHub Desktop.
Oracle Clones fact
# 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