Remove necessity to specify pid_file for process centric conditions
[god.git] / lib / god / behaviors / clean_pid_file.rb
blob7ef46ff55e95327a9d1e213a10fe09c3aeae3039
1 module God
2   module Behaviors
3     
4     class CleanPidFile < Behavior
5       def valid?
6         valid = true
7         valid &= complain("You must specify the 'pid_file' attribute on the Watch for :clean_pid_file") if self.watch.pid_file.nil?
8         valid
9       end
10   
11       def before_start
12         File.delete(self.watch.pid_file) rescue nil
13       end
14     end
15   
16   end
17 end