workaholic-cron 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/workaholic.rb +3 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8b2b6993e993311c9af07aa7cfb142534c9a285
4
- data.tar.gz: c049fa2c20eb9b13e926231d781fdda1af619d03
3
+ metadata.gz: e0297d803d19049bb9c2d489c1b93db2b45ae8fa
4
+ data.tar.gz: 0b689792a2a112c9ccb16c144afe1ebc74fdf9d7
5
5
  SHA512:
6
- metadata.gz: 7cce7ae0c10515cf84f983c91d12ea576207b0b401c6c17812eb1979e165100ed238d3745f4a98726562164123fb1952c9c937858145f3b4372e61bede1732df
7
- data.tar.gz: 89f8b1ef1bfab0de5fd95db77b50beb60df58db1b4d53eb4518ab6adc439b86e66ac25e5dded8e9613316115ec31d9c853331e5f4b57803e2b5c3078211a3875
6
+ metadata.gz: 810dc5e91ab142225315cf64e5514eb7ff933b5db7b8f1d3dbae196cfb7df5212a24502ef60c54d29e3e1a9cfed208a4ea5139afcdef94785dabe82f5978c2f4
7
+ data.tar.gz: 247eea18bb7b5e030f5f44e22b16fbe10a4fc0d27e27a481fd6ee47dc54b92698cf846bfc5683b7f937a8911e19bedf5c1119998f6d468d5497d4b8bb4a50a04
data/lib/workaholic.rb CHANGED
@@ -1,6 +1,4 @@
1
1
  #!/bin/ruby
2
- require 'time'
3
-
4
2
  class Workaholic
5
3
  # Find long running cron jobs.
6
4
  #
@@ -8,7 +6,7 @@ class Workaholic
8
6
  # >> require 'workaholic'
9
7
  # >> workers = Workaholic.new 'cron', 300
10
8
  # >> workers.scan
11
- # => => {:"4389"=>71983, :"4335"=>71994}
9
+ # => {:"4389"=>71983, :"4335"=>71994}
12
10
  #
13
11
  # Arguments:
14
12
  # proccess: (String)
@@ -22,11 +20,11 @@ class Workaholic
22
20
 
23
21
  def scan
24
22
  # Get all child processes of the desired parent process.
25
- pids = %x(ps -o pid,etime --ppid=`pidof -s #{proccess}` --sort=etime | awk '{print $1,$2}' | tr '-' ' ' | awk '{print $1,$3}' | egrep '^[0-9]' | grep ':')
23
+ pids = %x(ps -o pid,etime --ppid=`pidof -s #{@proccess}` --sort=etime | awk '{print $1,$2}' | tr '-' ' ' | awk '{print $1,$3}' | egrep '^[0-9]' | grep ':')
26
24
  workaholics = {}
27
25
  pids.each_line do |proccess|
28
26
  pid, etime = proccess.split
29
- workaholics[pid.to_sym] = etime_to_i etime if (etime_to_i etime) > limit
27
+ workaholics[pid.to_sym] = etime_to_i etime if (etime_to_i etime) > @limit
30
28
  end
31
29
  workaholics
32
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workaholic-cron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alaa Qutaish