def start
      # Check prerequisites
      raise RestFtpDaemon::AssertionFailed, "run/source_loc" unless @source_loc
      raise RestFtpDaemon::AssertionFailed, "run/target_loc" unless @target_loc

      # Remember when we started
      @started_at = Time.now

      # Notify we start working
      log_info "client_notify [started]"
      current_signal = :started
      set_status JOB_STATUS_WORKING
      client_notify :started

      # Before work
      log_debug "do_before"
      current_signal = :started
      do_before

      # Do the hard work
      log_debug "do_work"
      current_signal = :ended
      do_work

      # Finalize all this
      log_debug "do_after"
      current_signal = :ended
      do_after

    rescue StandardError => exception
      Rollbar.error exception, "job [#{error}]: #{exception.class.name}: #{exception.message}"
      return oops current_signal, exception

    else
      # All done !
      set_status JOB_STATUS_FINISHED
      log_info "client_notify [ended]"
      client_notify :ended
    end
def start
      # Check prerequisites
      raise RestFtpDaemon::AssertionFailed, "run/source_loc" unless @source_loc
      raise RestFtpDaemon::AssertionFailed, "run/target_loc" unless @target_loc

      # Remember when we started
      @started_at = Time.now

      # Notify we start working
      log_info "client_notify [started]"
      current_signal = :started
      set_status JOB_STATUS_WORKING
      client_notify :started

      # Before work
      log_debug "do_before"
      current_signal = :started
      do_before

      # Do the hard work
      log_debug "do_work"
      current_signal = :ended
      do_work

      # Finalize all this
      log_debug "do_after"
      current_signal = :ended
      do_after

    rescue StandardError => exception
      Rollbar.error exception, "job [#{error}]: #{exception.class.name}: #{exception.message}"
      return oops current_signal, exception

    else
      # All done !
      set_status JOB_STATUS_FINISHED
      log_info "client_notify [ended]"
      client_notify :ended
    end
Process job