Hi,

This little script can be used to keep track of number of tape
usages. I use it with recent GNU tools on a Linux machine.

Multiple skript calls per configuration and day do no harm thanks to
"uniq" and file time comparison. The calling user needs write access
to the config dir in /etc/amanda/<config>. I looked at amgetconf to
find the configuration directory but could not find the right entry in
amanda.conf.

What about adding the output of this skript to the daily mail? At the
moment I have to add it to the cron job and might miss "amflush"'es.

Please feel free to modify the script. May it save you from worn out
tapes at restore time.

Johannes Niess

P.S: Keep an eye on line endings for the commands.


#! /bin/sh
# Made by Johannes Niess (mail: [EMAIL PROTECTED])
if test -z $1 ; then echo "Amanda-tapestats reports the number of times the tape list 
entry has been updated. The skript has to be run at least once after each update.
Usage: amanda-tapestats <amanda-configuration>";exit;fi

if test /etc/amanda/$1/tapelist.long -ot /etc/amanda/$1/tapelist;
then
echo "Amanda tape usage count";
cut -d " " -f 1,2 /etc/amanda/$1/tapelist*|sort|uniq >tapelist.$ && mv tapelist.$ 
/etc/amanda/$1/tapelist.long;
cut -f 2 -d " " /etc/amanda/$1/tapelist.long |sort|uniq -c|sort -rn > 
/etc/amanda/$1/tapecount && cat /etc/amanda/$1/tapecount;
fi                         

Reply via email to