Class: RunitMan
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- RunitMan
- Defined in:
- lib/runit-man/app.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.register_as_runit_service ⇒ Object
108 109 110 111 112 113 |
# File 'lib/runit-man/app.rb', line 108 def register_as_runit_service create_run_script return if File.symlink?(File.join(RunitMan.all_services_directory, 'runit-man')) do_cmd("ln -sf #{File.join(GEM_FOLDER, 'sv')} #{File.join(RunitMan.all_services_directory, 'runit-man')}") do_cmd("ln -sf #{File.join(RunitMan.all_services_directory, 'runit-man')} #{File.join(RunitMan.active_services_directory, 'runit-man')}") end |
Instance Method Details
#log_action(name, text) ⇒ Object
84 85 86 87 88 |
# File 'lib/runit-man/app.rb', line 84 def log_action(name, text) env = request.env addr = env.include?('X_REAL_IP') ? env['X_REAL_IP'] : env['REMOTE_ADDR'] puts "#{addr} - - [#{Time.now}] \"Do #{text} on #{name}\"" end |
#log_of_service(name, count) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/runit-man/app.rb', line 56 def log_of_service(name, count) count = count.to_i count = MIN_TAIL if count < MIN_TAIL count = MAX_TAIL if count > MAX_TAIL srv = ServiceInfo[name] return nil if srv.nil? || !srv.logged? { :name => name, :count => count, :log_location => srv.log_file_location, :text => `tail -n #{count} #{srv.log_file_location}` } end |