NAME

snap_charge -- add together charges for snapback2


SYNOPSIS

snap_charge [-p|-i] [-c client] [-y year] [-m month] <chargefile>


DESCRIPTION

When passed a snapback2 charge log filename, compiles and prints a report. The report will be in N.N[KMGT] format, i.e:

        100  is 100 bytes
        100K is 100 kilobytes where a kilobyte is 1024 bytes
        100M is 100 megabytes where a megabyte is 1024 kilobytes
        100G is 100 gigabytes where a gigabyte is 1024 megabytes
        100T is 100 terabytes where a terabyte is 1024 gigabytes

The charges are based on the bytes read statement returned by rsync at backup time. All directories under a client domain name are added together.


OPTIONS

-c client

Selects one client domain to report for. If passed -p, -i, or -y YYYY and -m MM, prints only the number of bytes for that month and nothing else. If no year/month combination (that includes -i or -p) is sent, then prints a tab-delimited numeric report line for each month:

        YYYYMM  NNNNNNNNN

Implies the -n option.

-i

Summarize charges for current month -- same as passing -y and -m set to the current year and month.

-m MM

The month to report on. Requires -y.

-n

Print numbers only. Forced if -c option is passed. Otherwise, the report looks like:

        foo.org in 2004-01: 288.6M
        bill.bar.net in 2004-01: 8.5G
        bob.bar.net in 2004-01: 1.2T
-p

Summarize charges for last month -- same as passing -y and -m set to the previous month (and year if in January).

-y YYYY

The year to report on.


BUGS

Should be enhanced to read snapback2 configuration file and figure out the charge log. That will happen when the functions of snapback2 are modularized -- if they ever are.


AUTHOR

Mike Heins, <snapback2@perusion.org>.