autoparts icon indicating copy to clipboard operation
autoparts copied to clipboard

pid checks in running? should verify that the process is indeed alive

Open petejkim opened this issue 10 years ago • 0 comments

The following fails after a restart because pid isn't cleaned up correctly on box shut down.

https://github.com/nitrous-io/autoparts/blob/master/lib/autoparts/packages/apache2.rb#L85

      def running?
        pid = Path.var + name + "run" + "httpd.pid"
        pid.exist?
      end

Do something like this instead:

https://github.com/nitrous-io/autoparts/blob/master/lib/autoparts/packages/mongodb.rb#L84

      def running?
        if mongod_pid_file_path.exist?
          pid = File.read(mongod_pid_file_path).strip
          if pid.length > 0 && `ps -o cmd= #{pid}`.include?(mongod_path.basename.to_s)
            return true
          end
        end
        false
      end

petejkim avatar Mar 07 '14 03:03 petejkim