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

Version Path
filbunke-1.6.0 bin/filbunked
filbunke-1.5.3 bin/filbunked
filbunke-1.5.2 bin/filbunked
filbunke-1.5.1 bin/filbunked
filbunke-1.5.0 bin/filbunked
filbunke-1.4.1 bin/filbunked
filbunke-1.4.0 bin/filbunked
filbunke-1.3.0 bin/filbunked
filbunke-1.2.1 bin/filbunked
filbunke-1.2.0 bin/filbunked
filbunke-1.1.15 bin/filbunked
filbunke-1.1.14 bin/filbunked
filbunke-1.1.13 bin/filbunked
filbunke-1.1.12 bin/filbunked
filbunke-1.1.11 bin/filbunked
filbunke-1.1.10 bin/filbunked
filbunke-1.1.9 bin/filbunked
filbunke-1.1.8 bin/filbunked
filbunke-1.1.7 bin/filbunked
filbunke-1.1.6 bin/filbunked