lobster 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/lobster/job.rb CHANGED
@@ -39,7 +39,7 @@ module Lobster
39
39
 
40
40
  def run(out,err,dir)
41
41
  Lobster.logger.info "Starting job #{@name}"
42
- command_line = @user ? "sudo -nu #{@user} sh -c \"#{@command}\"" : @command
42
+ command_line = @user ? "sudo -inu #{@user} \"cd $PWD ; #{@command}\"" : @command
43
43
 
44
44
  begin
45
45
  @pid = spawn(command_line, :out=>out, :err=>err, :chdir=>dir)
@@ -70,12 +70,16 @@ module Lobster
70
70
  end
71
71
 
72
72
  Lobster.logger.info "Killing pid #{pid}"
73
- begin
74
- Process.kill sig, pid
75
- rescue Errno::ESRCH
76
- # Process already got killed somehow
77
- rescue Exception => e
78
- Lobster.logger.warn "Process #{pid} exception: #{e}"
73
+ if @user
74
+ `sudo -inu #{@user} "kill -s #{sig} #{pid}"`
75
+ else
76
+ begin
77
+ Process.kill sig, pid
78
+ rescue Errno::ESRCH
79
+ # Process already got killed somehow
80
+ rescue Exception => e
81
+ Lobster.logger.warn "Process #{pid} exception: #{e}"
82
+ end
79
83
  end
80
84
  end
81
85
  end
@@ -1,3 +1,3 @@
1
1
  module Lobster
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lobster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-02 00:00:00.000000000 Z
12
+ date: 2012-01-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: daemons
16
- requirement: &84449170 !ruby/object:Gem::Requirement
16
+ requirement: &75477200 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 1.1.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *84449170
24
+ version_requirements: *75477200
25
25
  description: ''
26
26
  email:
27
27
  - m.brugidou@criteo.com
@@ -34,7 +34,6 @@ files:
34
34
  - .gitignore
35
35
  - Gemfile
36
36
  - Gemfile.lock
37
- - LICENSE
38
37
  - README.md
39
38
  - bin/lobster
40
39
  - bin/lobsterize
data/LICENSE DELETED
@@ -1,13 +0,0 @@
1
- Copyright 2011 Criteo
2
-
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
-
7
- http://www.apache.org/licenses/LICENSE-2.0
8
-
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS,
11
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- See the License for the specific language governing permissions and
13
- limitations under the License.