#!/bin/sh
if test -z "$1" ; then
	DB=~/devlpt/data/multimedia.db
	FILE=report-$(hostname)-$(date -r $DB '+%y%m%d').txt
else	DB="$1"
	FILE=report-$(echo $DB | sed s@/@_@g)-$(date -r $DB '+%y%m%d').txt
fi
if test -f $FILE ; then
	echo "can't create '$FILE' already exists !"
	exit 1
fi
if ./report-db.py "$DB" > $FILE ; then
	echo "file $FILE created successfully"
else
	echo "Error ! file $FILE not created properly"
fi
