Sha256: 82d8e5791a35f57948e9939c6ccf90f35904084d849a2e32e64598d66d79b402
Contents?: true
Size: 1.02 KB
Versions: 6
Compression:
Stored size: 1.02 KB
Contents
#!/usr/bin/env ruby #Unset Connection Script #@author Aldo require 'logger' require 'rest_client' path = "/var/log/ejabberd/scripts.log" file = File.open(path, File::WRONLY | File::APPEND | File::CREAT) file.sync = true $logger = Logger.new(file) $logger.level = Logger::DEBUG def getOption(option) File.open('/etc/ejabberd/ssconfig.cfg', 'r') do |f1| while line = f1.gets line = line.gsub(/\n/,'') if line.match(/^#/) #Comments elsif line.match(/^#{option}/) return line.gsub(/#{option}/,'') end end end return "Undefined" end $url = "http://" + getOption("web_domain=") + "/xmpp/unsetConnection" $pass = getOption("ejabberd_password=") def log(text) $logger.info "Unset Connection: " + text end def unsetConnection(username) log("unsetConnection(#{username})") RestClient.post($url, :name => username, :password => $pass) return true rescue RestClient::Exception log("RestClient::Exception with unsetConnection(#{username})") end unsetConnection(ARGV[0])
Version data entries
6 entries across 6 versions & 2 rubygems