make self-daemonizing command synchronous
[god.git] / lib / god / behaviors / clean_pid_file.rb
blobdf404fa8baab778de53610d242a4adbf2ec8ad1d
1 module God
2   module Behaviors
3     
4     class CleanPidFile < Behavior
5       def valid?
6         valid = true
7         valid &= complain("Attribute 'pid_file' must be specified", self) if self.watch.pid_file.nil?
8         valid
9       end
10   
11       def before_start
12         File.delete(self.watch.pid_file)
13         
14         "deleted pid file"
15       rescue
16         "no pid file to delete"
17       end
18     end
19   
20   end
21 end