#!/bin/sh
# Copyright (c) 2011 Index Data ApS. http://indexdata.com
# Author: Wolfram Schneider
#
# billing - fetch billing statistics from customers on a regular basis
#
# see http://twiki.indexdata.dk/cgi-bin/twiki/view/ID/MasterkeyPricingStructure


set -e

: ${directory=/var/lib/masterkey/billing}
: ${customer="mk2-devel.indexdata.com"}
: ${token="GammelStrand"}

wget="wget --content-disposition"

for c in $customer
do
    mkdir -p $directory/$c
    ( cd $directory/$c
      $wget "$customer/console/reports/billing.cgi?token=$token"
    )
done

