Sha256: 57b660dde9bb1a2b14f2f45973fb2da9e917570dbfed95bf1eb639bae11acf62
Contents?: true
Size: 838 Bytes
Versions: 22
Compression:
Stored size: 838 Bytes
Contents
#!/usr/bin/env ruby $0=File.join(File.dirname(__FILE__), 'filbunked') require 'rubygems' require 'filbunke' require 'yaml' require 'getoptlong' raw_opts = GetoptLong.new( [ '--help', '-h', GetoptLong::NO_ARGUMENT ], [ '--config', '-c', GetoptLong::REQUIRED_ARGUMENT ] ) opts = {} raw_opts.each do |opt, arg| opts[opt] = arg end if Process.uid != 0 then puts "Filbunke should be started as root!" exit 1 end if opts['--help'] || opts['--config'] == nil || opts['--config'] == "" puts "Usage: filbunked -c <config_file.yml>" exit 1 else child_process = fork { config_file = File.read(opts['--config']) config = YAML.load(config_file) daemon = Filbunke::Daemon.new(config) Process::UID.change_privilege(Etc.getpwnam(config["user"]).uid) daemon.run! } Process.detach(child_process) end
Version data entries
22 entries across 22 versions & 1 rubygems