Sha256: 13900981527b17412694a9f3afa6065dc82a751c5fa9895a80aaee4cfb648d50

Contents?: true

Size: 1.09 KB

Versions: 6

Compression:

Stored size: 1.09 KB

Contents

#!/usr/bin/env ruby
#Reset 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/resetConnection"
$pass = getOption("ejabberd_password=")


def log(text)
	$logger.info "Reset Connection Script: " + text
end


def resetConnection()
  begin
    RestClient.post($url, :password => $pass)
    return true
  rescue => e
    log("#{e.class.name}: #{e.message}")
    return false
  end
end

if (resetConnection())
  puts "Reset Connection [OK]"
  log( "Reset Connection [OK]" )
else
  puts "Reset Connection [FAIL]"
  log( "Reset Connection [FAIL]" )
end


Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
social_stream-0.15.4 presence/ejabberd/ejabberd_scripts/reset_connection_script
social_stream-0.15.1 presence/ejabberd/ejabberd_scripts/reset_connection_script
social_stream-0.15.0 presence/ejabberd/ejabberd_scripts/reset_connection_script
social_stream-presence-0.1.4 ejabberd/ejabberd_scripts/reset_connection_script
social_stream-0.14.1 presence/ejabberd/ejabberd_scripts/reset_connection_script
social_stream-0.14.0 presence/ejabberd/ejabberd_scripts/reset_connection_script