seppuku 0.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Manifest +3 -2
- data/README.rdoc +25 -0
- data/Rakefile +1 -1
- data/lib/seppuku.rb +13 -21
- data/seppuku.gemspec +5 -5
- metadata +8 -7
- data/README +0 -34
data/Manifest
CHANGED
data/README.rdoc
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
=Seppuku
|
2
|
+
|
3
|
+
Seppuku is a ruby cmdline utility that simplifies killing running processes.
|
4
|
+
Just specify the kill level and program name with the command-line switches;
|
5
|
+
Seppuku will prompt you whether you'd like to kill all listed matches or if you'd like
|
6
|
+
to pick and choose.
|
7
|
+
|
8
|
+
=Usage
|
9
|
+
seppuku -h
|
10
|
+
Usage: seppuku [options]
|
11
|
+
-n, --name NAME Process name within ps table
|
12
|
+
-l, --level LEVEL Kill level for operation
|
13
|
+
-h, --help Show this screen
|
14
|
+
|
15
|
+
=Example
|
16
|
+
sudo seppuku -l 9 -n program_name
|
17
|
+
|
18
|
+
|
19
|
+
=Installation
|
20
|
+
gem install seppuku
|
21
|
+
|
22
|
+
=Notes
|
23
|
+
should work with most distros. tested with bsd and debian.
|
24
|
+
|
25
|
+
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('seppuku', '0.2') do |p|
|
5
|
+
Echoe.new('seppuku', '0.2.1') do |p|
|
6
6
|
p.description = "a ruby cmdline utility that simplifies killing procs listed in your ps table"
|
7
7
|
p.url = "http://github.com/gadogado/seppuku"
|
8
8
|
p.author = "Geoff Ereth"
|
data/lib/seppuku.rb
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'optparse'
|
3
3
|
require 'open3'
|
4
4
|
|
5
|
-
REGEXP =
|
5
|
+
REGEXP = /(\d+)\s+(.*?)$/
|
6
6
|
PS = 'ps ax -o pid -o command'
|
7
7
|
|
8
8
|
class Seppuku
|
@@ -14,7 +14,7 @@ class Seppuku
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def search
|
17
|
-
@search ||= Regexp.new(@opts[:name])
|
17
|
+
@search ||= Regexp.new(@opts[:name])
|
18
18
|
end
|
19
19
|
|
20
20
|
def command
|
@@ -62,7 +62,7 @@ class Seppuku
|
|
62
62
|
def kill_all_or_wisely
|
63
63
|
if matches.size > 1
|
64
64
|
kill_ques('*ALL*')
|
65
|
-
ans = gets
|
65
|
+
ans = STDIN.gets
|
66
66
|
proceed.call(ans) ? kill_all(matches) : kill_wisely(matches)
|
67
67
|
else
|
68
68
|
kill_wisely(matches)
|
@@ -70,8 +70,7 @@ class Seppuku
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def disengage
|
73
|
-
puts '<-> nothing to kill <->'
|
74
|
-
exit
|
73
|
+
puts '<-> nothing to kill <->'; exit
|
75
74
|
end
|
76
75
|
|
77
76
|
def kill(m)
|
@@ -80,7 +79,6 @@ class Seppuku
|
|
80
79
|
cmd = "kill -#{@opts[:level]} #{pid}"
|
81
80
|
command.call(cmd)
|
82
81
|
puts "<.> killed:#{pid} <.>"
|
83
|
-
|
84
82
|
rescue Exception => msg
|
85
83
|
puts "#{msg} #{msg.backtrace.join(' ')}"
|
86
84
|
end
|
@@ -91,33 +89,27 @@ class Seppuku
|
|
91
89
|
end
|
92
90
|
|
93
91
|
def match(m)
|
94
|
-
"
|
92
|
+
"[*] #{m.join(' -- ')}"
|
95
93
|
end
|
96
94
|
|
97
95
|
def kill_ques(type)
|
98
|
-
puts "
|
96
|
+
puts "[y/n] kill #{type} (?):"
|
99
97
|
end
|
100
98
|
|
101
99
|
def ready
|
102
100
|
@opts={}
|
103
|
-
options = OptionParser.new do |
|
104
|
-
|
105
|
-
|
106
|
-
|
101
|
+
options = OptionParser.new do |opt|
|
102
|
+
opt.on('-n','--name NAME',"Process name within ps table") { |name| @opts[:name] = name }
|
103
|
+
opt.on('-l','--level LEVEL',"Kill level for operation") { |level| @opts[:level] = level }
|
104
|
+
opt.on('-h', '--help', 'Show this screen') { puts options; exit }
|
107
105
|
end
|
108
106
|
parse(options)
|
109
107
|
end
|
110
108
|
|
111
109
|
def parse(options)
|
112
110
|
options.parse!
|
113
|
-
|
114
|
-
puts options
|
115
|
-
raise OptionParser::MissingArgument
|
116
|
-
end
|
111
|
+
( puts options; exit ) unless @opts[:name] && @opts[:level]
|
117
112
|
end
|
118
|
-
|
113
|
+
|
119
114
|
end
|
120
|
-
end
|
121
|
-
|
122
|
-
|
123
|
-
|
115
|
+
end
|
data/seppuku.gemspec
CHANGED
@@ -2,19 +2,19 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{seppuku}
|
5
|
-
s.version = "0.2"
|
5
|
+
s.version = "0.2.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Geoff Ereth"]
|
9
|
-
s.date = %q{2010-07-
|
9
|
+
s.date = %q{2010-07-11}
|
10
10
|
s.default_executable = %q{seppuku}
|
11
11
|
s.description = %q{a ruby cmdline utility that simplifies killing procs listed in your ps table}
|
12
12
|
s.email = %q{geoffereth @nospamplease@ gmail com}
|
13
13
|
s.executables = ["seppuku"]
|
14
|
-
s.extra_rdoc_files = ["README", "bin/seppuku", "lib/seppuku.rb"]
|
15
|
-
s.files = ["README", "Rakefile", "bin/seppuku", "lib/seppuku.rb", "
|
14
|
+
s.extra_rdoc_files = ["README.rdoc", "bin/seppuku", "lib/seppuku.rb"]
|
15
|
+
s.files = ["Manifest", "README.rdoc", "Rakefile", "bin/seppuku", "lib/seppuku.rb", "seppuku.gemspec"]
|
16
16
|
s.homepage = %q{http://github.com/gadogado/seppuku}
|
17
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Seppuku", "--main", "README"]
|
17
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Seppuku", "--main", "README.rdoc"]
|
18
18
|
s.require_paths = ["lib"]
|
19
19
|
s.rubyforge_project = %q{seppuku}
|
20
20
|
s.rubygems_version = %q{1.3.7}
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seppuku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Geoff Ereth
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-11 00:00:00 -07:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -25,15 +26,15 @@ executables:
|
|
25
26
|
extensions: []
|
26
27
|
|
27
28
|
extra_rdoc_files:
|
28
|
-
- README
|
29
|
+
- README.rdoc
|
29
30
|
- bin/seppuku
|
30
31
|
- lib/seppuku.rb
|
31
32
|
files:
|
32
|
-
-
|
33
|
+
- Manifest
|
34
|
+
- README.rdoc
|
33
35
|
- Rakefile
|
34
36
|
- bin/seppuku
|
35
37
|
- lib/seppuku.rb
|
36
|
-
- Manifest
|
37
38
|
- seppuku.gemspec
|
38
39
|
has_rdoc: true
|
39
40
|
homepage: http://github.com/gadogado/seppuku
|
@@ -46,7 +47,7 @@ rdoc_options:
|
|
46
47
|
- --title
|
47
48
|
- Seppuku
|
48
49
|
- --main
|
49
|
-
- README
|
50
|
+
- README.rdoc
|
50
51
|
require_paths:
|
51
52
|
- lib
|
52
53
|
required_ruby_version: !ruby/object:Gem::Requirement
|
data/README
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
= Project: Seppuku
|
2
|
-
|
3
|
-
= Description:
|
4
|
-
|
5
|
-
Seppuku is a cmdline utility that simplifies killing procs listed in your ps table.
|
6
|
-
You simply specify the kill level and program name you want to kill - Seppuku will
|
7
|
-
prompt you to either kill *all* matches in the ps table, or, prompt you for each process
|
8
|
-
entry found.
|
9
|
-
|
10
|
-
= Usage
|
11
|
-
|
12
|
-
seppku -h
|
13
|
-
Usage: seppuku [options]
|
14
|
-
-n, --name NAME Process name within ps table
|
15
|
-
-l, --level LEVEL Kill level for operation
|
16
|
-
-h, --help Show this screen
|
17
|
-
|
18
|
-
= Example
|
19
|
-
|
20
|
-
seppuku -l 9 - n deathrow_program
|
21
|
-
|
22
|
-
|
23
|
-
= Installation
|
24
|
-
|
25
|
-
Gem is hosted on gemcutter.org
|
26
|
-
|
27
|
-
1.) gem install seppuku
|
28
|
-
|
29
|
-
= Notes:
|
30
|
-
the ps scan regexp might not work with *all* system ps utilities; if you experience any problems try to change
|
31
|
-
the ps related constants within the main lib file.
|
32
|
-
|
33
|
-
|
34
|
-
|