Sha256: e588433cabe80a51dba5c5be27a94568ea0c3990194cadf21182d13734df53d0
Contents?: true
Size: 1.12 KB
Versions: 8
Compression:
Stored size: 1.12 KB
Contents
#!/usr/bin/env ruby require 'optparse' require 'ostruct' require "rubygems" require "mandy" HadoopConfiguration.check_home_and_version exec('mandy-rm -h') unless ARGV.size >= 1 options = OpenStruct.new OptionParser.new do |opts| opts.banner = "USAGE: mandy-rm file_or_folder_on_hdfs [options]" opts.on("-c", "--conf HADOOP_CONF", "Use this cluster xml config file.") do |config| options.config = config end opts.on("-f", "--force", "Use this paramter to force deletion of a relative folder, root folder or 1st level folder (like /home or /tmp)") do options.force = true end opts.on_tail("-h", "--help", "Show this message") do puts opts exit end end.parse! file = ARGV[0] config = options.config || 'cluster.xml' if !options.force and file =~ /^[^\/]/ puts "mandy-rm: Cowardly refusing to delete a relative folder. Use -f parameter to force command." exit end if !options.force and File.expand_path(file).split("/").size <= 2 puts "mandy-rm: Cowardly refusing to delete a root or 1st level folder. Use -f parameter to force command." exit end `$HADOOP_HOME/bin/hadoop fs -conf #{config} -rmr #{file}`
Version data entries
8 entries across 8 versions & 1 rubygems