Sha256: 4d6efec6cd975aa0caa758a7740d8dfbf704f08e1f934e051c8891d9bf732507
Contents?: true
Size: 1.47 KB
Versions: 1
Compression:
Stored size: 1.47 KB
Contents
#!/usr/bin/env ruby require 'optparse' require 'suj/pusher' require 'fileutils' require 'daemon_spawn' BANNER = "Usage: pusher start|stop|restart|status [options]" WORKDIR = Dir.pwd class PusherDaemon < DaemonSpawn::Base def start(args) @daemon = Suj::Pusher::Daemon.new @daemon.start end def stop @daemon.stop end end redis = "redis://localhost:6379/pusher" logdir = File.join(WORKDIR, "logs") piddir = File.join(WORKDIR, "pids") cerdir = File.join(WORKDIR, "certs") ARGV.options do |opts| opts.banner = BANNER opts.on('-r REDIS', '--redis REDIS', String, 'Redis server to connect') { |r|redis = r } opts.on('-l LOGS', '--logdir LOGS', String, 'Logs destination directory') { |l| logdir = l } opts.on('-p PIDS', '--piddir PIDS', String, 'Pids destination diercoty') { |pid| piddir = pid } opts.on('-c CERTS', '--cerdir CERTS', String, 'Directory to store certificates') { |cert| cerdir = cert } opts.on('-v', '--version', 'Print this version of pusher daemon.') { puts "rapns #{Suj::Pusher::VERSION}"; exit } opts.on('-h', '--help', 'You\'re looking at it.') { puts opts; exit } opts.parse! end FileUtils.mkdir_p(cerdir) FileUtils.mkdir_p(logdir) FileUtils.mkdir_p(piddir) config = Suj::Pusher::Configuration.new config.certs_path = cerdir config.redis = redis Suj::Pusher.config.update(config) PusherDaemon.spawn!( sync_log: true, working_dir: Dir.pwd, log_file: File.join(logdir, "pusher-worker.log"), pid_file: File.join(piddir, "pusher-worker.pid") )
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
suj-pusher-0.1.3 | bin/pusher |