Class: Maatkit::Kill

Inherits:
Object
  • Object
show all
Defined in:
lib/maatkit-ruby/mk-kill.rb

Overview

Kill MySQL queries that match certain criteria.

Maatkit::Kill.new( array, str, array)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeKill

Returns a new Kill Object



67
68
# File 'lib/maatkit-ruby/mk-kill.rb', line 67

def initialize()
end

Instance Attribute Details

#allObject

FALSE



15
16
17
# File 'lib/maatkit-ruby/mk-kill.rb', line 15

def all
  @all
end

#ask_passObject

FALSE



16
17
18
# File 'lib/maatkit-ruby/mk-kill.rb', line 16

def ask_pass
  @ask_pass
end

#busy_timeObject

(No value)



17
18
19
# File 'lib/maatkit-ruby/mk-kill.rb', line 17

def busy_time
  @busy_time
end

#charsetObject

(No value)



18
19
20
# File 'lib/maatkit-ruby/mk-kill.rb', line 18

def charset
  @charset
end

#configObject

/etc/maatkit/maatkit.conf,/etc/maatkit/mk_kill.conf,/home/joel/.maatkit.conf,/home/joel/.mk_kill.conf



19
20
21
# File 'lib/maatkit-ruby/mk-kill.rb', line 19

def config
  @config
end

#daemonizeObject

FALSE



20
21
22
# File 'lib/maatkit-ruby/mk-kill.rb', line 20

def daemonize
  @daemonize
end

#defaults_fileObject

(No value)



21
22
23
# File 'lib/maatkit-ruby/mk-kill.rb', line 21

def defaults_file
  @defaults_file
end

#execute_commandObject

(No value)



22
23
24
# File 'lib/maatkit-ruby/mk-kill.rb', line 22

def execute_command
  @execute_command
end

#heartbeatObject

FALSE



23
24
25
# File 'lib/maatkit-ruby/mk-kill.rb', line 23

def heartbeat
  @heartbeat
end

#helpObject

TRUE



24
25
26
# File 'lib/maatkit-ruby/mk-kill.rb', line 24

def help
  @help
end

#hostObject

(No value)



25
26
27
# File 'lib/maatkit-ruby/mk-kill.rb', line 25

def host
  @host
end

#idle_timeObject

(No value)



26
27
28
# File 'lib/maatkit-ruby/mk-kill.rb', line 26

def idle_time
  @idle_time
end

#ignore_commandObject

(No value)



27
28
29
# File 'lib/maatkit-ruby/mk-kill.rb', line 27

def ignore_command
  @ignore_command
end

#ignore_dbObject

(No value)



28
29
30
# File 'lib/maatkit-ruby/mk-kill.rb', line 28

def ignore_db
  @ignore_db
end

#ignore_hostObject

(No value)



29
30
31
# File 'lib/maatkit-ruby/mk-kill.rb', line 29

def ignore_host
  @ignore_host
end

#ignore_infoObject

(No value)



30
31
32
# File 'lib/maatkit-ruby/mk-kill.rb', line 30

def ignore_info
  @ignore_info
end

#ignore_selfObject

TRUE



31
32
33
# File 'lib/maatkit-ruby/mk-kill.rb', line 31

def ignore_self
  @ignore_self
end

#ignore_stateObject

Locked



32
33
34
# File 'lib/maatkit-ruby/mk-kill.rb', line 32

def ignore_state
  @ignore_state
end

#ignore_userObject

(No value)



33
34
35
# File 'lib/maatkit-ruby/mk-kill.rb', line 33

def ignore_user
  @ignore_user
end

#intervalObject

30



34
35
36
# File 'lib/maatkit-ruby/mk-kill.rb', line 34

def interval
  @interval
end

#iterationsObject

1



35
36
37
# File 'lib/maatkit-ruby/mk-kill.rb', line 35

def iterations
  @iterations
end

#killObject

FALSE



36
37
38
# File 'lib/maatkit-ruby/mk-kill.rb', line 36

def kill
  @kill
end

#kill_queryObject

FALSE



37
38
39
# File 'lib/maatkit-ruby/mk-kill.rb', line 37

def kill_query
  @kill_query
end

#logObject

(No value)



38
39
40
# File 'lib/maatkit-ruby/mk-kill.rb', line 38

def log
  @log
end

#match_commandObject

(No value)



39
40
41
# File 'lib/maatkit-ruby/mk-kill.rb', line 39

def match_command
  @match_command
end

#match_dbObject

(No value)



40
41
42
# File 'lib/maatkit-ruby/mk-kill.rb', line 40

def match_db
  @match_db
end

#match_hostObject

(No value)



41
42
43
# File 'lib/maatkit-ruby/mk-kill.rb', line 41

def match_host
  @match_host
end

#match_infoObject

(No value)



42
43
44
# File 'lib/maatkit-ruby/mk-kill.rb', line 42

def match_info
  @match_info
end

#match_stateObject

(No value)



43
44
45
# File 'lib/maatkit-ruby/mk-kill.rb', line 43

def match_state
  @match_state
end

#match_userObject

(No value)



44
45
46
# File 'lib/maatkit-ruby/mk-kill.rb', line 44

def match_user
  @match_user
end

#only_oldestObject

TRUE



45
46
47
# File 'lib/maatkit-ruby/mk-kill.rb', line 45

def only_oldest
  @only_oldest
end

#passwordObject

(No value)



46
47
48
# File 'lib/maatkit-ruby/mk-kill.rb', line 46

def password
  @password
end

#path_to_mk_killObject

Sets the executable path, otherwise the environment path will be used.



62
63
64
# File 'lib/maatkit-ruby/mk-kill.rb', line 62

def path_to_mk_kill
  @path_to_mk_kill
end

#pidObject

(No value)



47
48
49
# File 'lib/maatkit-ruby/mk-kill.rb', line 47

def pid
  @pid
end

#portObject

(No value)



48
49
50
# File 'lib/maatkit-ruby/mk-kill.rb', line 48

def port
  @port
end

FALSE



49
50
51
# File 'lib/maatkit-ruby/mk-kill.rb', line 49

def print
  @print
end

#replication_threadsObject

FALSE



50
51
52
# File 'lib/maatkit-ruby/mk-kill.rb', line 50

def replication_threads
  @replication_threads
end

#run_timeObject

(No value)



51
52
53
# File 'lib/maatkit-ruby/mk-kill.rb', line 51

def run_time
  @run_time
end

#set_varsObject

wait_timeout=10000



52
53
54
# File 'lib/maatkit-ruby/mk-kill.rb', line 52

def set_vars
  @set_vars
end

#socketObject

(No value)



53
54
55
# File 'lib/maatkit-ruby/mk-kill.rb', line 53

def socket
  @socket
end

#userObject

(No value)



54
55
56
# File 'lib/maatkit-ruby/mk-kill.rb', line 54

def user
  @user
end

#versionObject

FALSE



55
56
57
# File 'lib/maatkit-ruby/mk-kill.rb', line 55

def version
  @version
end

#wait_after_killObject

(No value)



56
57
58
# File 'lib/maatkit-ruby/mk-kill.rb', line 56

def wait_after_kill
  @wait_after_kill
end

#wait_before_killObject

(No value)



57
58
59
# File 'lib/maatkit-ruby/mk-kill.rb', line 57

def wait_before_kill
  @wait_before_kill
end

Instance Method Details

#start(options = nil) ⇒ Object

Execute the command



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/maatkit-ruby/mk-kill.rb', line 73

def start(options = nil)
  tmp = Tempfile.new('tmp')
  command = option_string() + options.to_s + " 2> " + tmp.path
  success = system(command)
  if success
    begin
      while (line = tmp.readline)
        line.chomp
        selected_string = line
      end
    rescue EOFError
      tmp.close
    end
    return selected_string
  else
    tmp.close!
    return success
  end
end