Sha256: 142c6398b795170dd3b5cad8ac1e98a036ead272daa5ac16af4e6ec1c25ad1a9
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
#!/usr/bin/env ruby require "rack" APP_ROOT = File.expand_path(File.dirname(__FILE__)) #пригодится pass=false port=8080 if ARGV.size==1 and (ARGV[0]=='-h' or ARGV[0]=='--help') puts "ServState usage\nDefault port: 8080\nDefault password: no password\nSet port: -port XXXX\nSet password: -pass *****" exit end if ARGV.size.odd? puts "Something wrong with params" exit end ARGV.each_slice(2) { |slice| case slice[0] when '-port' port=slice[1].to_i when '-pass' pass=slice[1] end } APP_OPTIONS={ password: pass, port: port } require_relative "./../lib/ServState.rb" #добавить настройки порта и прочее Thread.new{ # thread for calculate cpu and network load and other long time operations while true Info.update sleep(5) end } puts " ____ ____ _ _ " puts "/ ___| ___ _ ____ __/ ___|| |_ __ _| |_ ___ " puts "\\___ \\ / _ \\ '__\\ \\ / /\\___ \\| __/ _` | __/ _ \\" puts " ___) | __/ | \\ V / ___) | || (_| | || __/" puts "|____/ \\___|_| \\_/ |____/ \\__\\__,_|\\__\\___|" puts "\nPORT: #{port}" if(pass) puts "PASSWORD: #{pass}" else puts "WITHOUT PASSWORD" end puts "\n"*3 Rack::Handler::WEBrick.run(ServStateApp,:Port => APP_OPTIONS[:port])
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ServState-0.0.2 | bin/servstate |