def run(&block)
      unless @work = block
        raise ArgumentError, "Usage: run { while_we_have_the_lock }"
      end
      @shutdown = false
      @restart = false
      install_plugins
      startup # typically daemonizes the process, can have various implementations
      on_load.call(self) if on_load
      run_loop(&@work)
      on_exit.call(self) if on_exit
      shutdown
    end
def run(&block)
      unless @work = block
        raise ArgumentError, "Usage: run { while_we_have_the_lock }"
      end
      @shutdown = false
      @restart = false
      install_plugins
      startup # typically daemonizes the process, can have various implementations
      on_load.call(self) if on_load
      run_loop(&@work)
      on_exit.call(self) if on_exit
      shutdown
    end
Takes actual block of code that is to be guarded by
 the lock. The +run_loop+ method does the actual work.

 If 'daemon?' is true, your code (including +on_load+)
 will execute after a fork.

 Make sure you don't open files and sockets in the exiting
 parent process by mistake. Open them in code that is called
 via +on_load+.