forked from sarguru/stalkerd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproducer-dovecot.rb
More file actions
executable file
·43 lines (31 loc) · 900 Bytes
/
producer-dovecot.rb
File metadata and controls
executable file
·43 lines (31 loc) · 900 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env ruby
require 'rubygems'
require 'beanstalk-client'
require 'json'
require 'choice'
Choice.options do
header ''
header 'Specific options:'
option :beanstalk_port do
short '-B'
long '--beanstalk_port=PORT'
desc 'The port the beanstalk server listens to'
cast Integer
default 11300
end
option :beanstalk_host do
short '-H'
long '--beanstalk_host=HOST'
desc 'The host address the beanstalkd server listens to. The default is 127.0.0.1'
default '127.0.0.1'
end
end
rip = ENV['IP']
user= ENV['user']
curr_time = Time.now.to_i
service = 'dovecot'
data = { 'ip' => "#{rip}", 'username' =>"#{user}", 'time_logged'=> curr_time, 'service' => "#{service}" }
data_json = data.to_json
@beanstalk = Beanstalk::Pool.new(["#{Choice[:beanstalk_host]}:#{Choice[:beanstalk_port]}"])
@beanstalk.use "locationtube"
@beanstalk.put "#{data_json}"