[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Most recent archive



ons 2012-12-05 klockan 20:50 -0800 skrev Casey Rodarmor:
> Is there an easy way to get info about the most recent tarsnap archive, so
> that I can convince myself that my automated backup scripts are working?

In the end my tarsnap backup scripts, I have this snippet of code.

  export TZ=UTC
  RECENT=$(tarsnap --list-archives -v | grep -v "\.part" \
      | sed -nre "s/^.+\t([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2})$/\1/p" \
      | sort | tail -n 1)
  [ -n "$RECENT" ] && date -d "$RECENT" +%s > /var/lib/tarsnap/status/time

That way /var/lib/tarsnap/status/time always contains the unix time of
that machine's last successful backup. In turn I use Nagios to pull that
information, which is good because that way Nagios doesn't need access
to the tarsnap key, nor having to way for tarsnap --list-archives
complete each time.

  https://github.com/andreaso/tarsnap-helpers/blob/master/check_tarsnap


// Andreas

Attachment: signature.asc
Description: This is a digitally signed message part