pidof 0.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.
- checksums.yaml +7 -0
- data/lib/pidof.rb +17 -0
- metadata +45 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: ee99cb98f78cbbc146b77aec4c153994e8abd4f4
|
|
4
|
+
data.tar.gz: 38c0f702535d19a0adaa8b57556204f1dbe9e1a4
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 85bbb6892e151f7442db5ced240e834a15c3b2f951d06bf8bbc42c42f08e65c26de1f7e5e739d96682205b981a1a5067c83114160490359e6566344b6bd84872
|
|
7
|
+
data.tar.gz: 8ff4c4f46223ba7c3322a0cd0df83eeb10bb2a68d731a4936882f5deb843640556a17a72f8e6007ec0966f69dcd41f7a80778d7ed82bf258dcad38ea4a894233
|
data/lib/pidof.rb
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class Pidof
|
|
2
|
+
|
|
3
|
+
def self.find process_name
|
|
4
|
+
processes = `ps -eo pid,comm`
|
|
5
|
+
self.parse process_name, processes
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def self.parse process_name, process_list
|
|
10
|
+
line = process_list.match(/(\d+) #{process_name}/)
|
|
11
|
+
if line.nil?
|
|
12
|
+
return nil
|
|
13
|
+
end
|
|
14
|
+
line.to_s.split(' ').first.to_i
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: pidof
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: '0.1'
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Saadullah Saeed
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2013-10-12 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: A simple gem to find the pid of a process
|
|
14
|
+
email: saadullah.saeed@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/pidof.rb
|
|
20
|
+
homepage: http://rubygems.org/gems/pidof
|
|
21
|
+
licenses:
|
|
22
|
+
- MIT
|
|
23
|
+
metadata: {}
|
|
24
|
+
post_install_message:
|
|
25
|
+
rdoc_options: []
|
|
26
|
+
require_paths:
|
|
27
|
+
- lib
|
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - '>='
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
34
|
+
requirements:
|
|
35
|
+
- - '>='
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
requirements: []
|
|
39
|
+
rubyforge_project:
|
|
40
|
+
rubygems_version: 2.0.3
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: Pidof
|
|
44
|
+
test_files: []
|
|
45
|
+
has_rdoc:
|