summaryrefslogtreecommitdiffstats
path: root/lib/blink/objects/process.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-04-14 04:58:12 +0000
committerLuke Kanies <luke@madstop.com>2005-04-14 04:58:12 +0000
commitafd434921c9c71afd62b361970410644559e028f (patch)
tree5492e8a490b1d1e53de6b24cb70f59d87969e00f /lib/blink/objects/process.rb
parent67fae6d13151bec7204a6b7da5ade609a869ee9b (diff)
updates
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@152 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/blink/objects/process.rb')
-rw-r--r--lib/blink/objects/process.rb86
1 files changed, 0 insertions, 86 deletions
diff --git a/lib/blink/objects/process.rb b/lib/blink/objects/process.rb
deleted file mode 100644
index e2e5722fc..000000000
--- a/lib/blink/objects/process.rb
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/local/bin/ruby -w
-
-require 'blink/operation'
-require 'blink/operation/processes'
-
-# DISABLED
-# I'm only working on services, not processes, right now
-
-module Blink
- class Attribute
- class ProcessRunning < Attribute
- def retrieve
- running = 0
- regex = Regexp.new(@params[:pattern])
- begin
- # this ps is only tested on Solaris
- # XXX yeah, this definitely needs to be fixed...
- %x{ps -ef -U #{@params[:user]}}.split("\n").each { |process|
- if regex.match(process)
- running += 1
- end
- }
- rescue
- # this isn't correct, but what the hell
- Blink::Message.new(
- :level => :error,
- :source => self.object,
- :message => "Failed to run ps"
- )
- end
-
- self.state = running
- Blink.debug "there are #{running} #{self.object} processes for start"
- end
-
- def <=>(other)
- self.state < 1
- end
-
- def fix
- require 'etc'
- # ruby is really cool
- uid = 0
- if @params[:user].is_a? Integer
- uid = @params[:user]
- else
- uid = Etc.getpwnam(@params[:user]).uid
- end
- Kernel.fork {
- Process.uid = uid
- Process.euid = uid
- string = @params[:binary] + (@params[:arguments] || "")
- Blink::Message.new(
- :level => :notice,
- :source => self.object,
- :message => "starting"
- )
- Kernel.exec(string)
- }
- end
- end
- end
- class Objects
- class BProcess < Objects
- attr_reader :stat, :path
- @params = [:start, :stop, :user, :pattern, :binary, :arguments]
- @name = :process
-
- @namevar = :pattern
-
- Blink::Relation.new(self, Blink::Operation::Start, {
- :user => :user,
- :pattern => :pattern,
- :binary => :binary,
- :arguments => :arguments
- })
-
- Blink::Relation.new(self, Blink::Operation::Stop, {
- :user => :user,
- :pattern => :pattern
- })
-
- end # Blink::Objects::BProcess
- end # Blink::Objects
-
-end