#!/bin/sh CONFIG=/etc/gtic/autohatch.conf GTIC=/usr/local/gtic/gtic SYSOP=root # format of config file: # directory_with_mirror:dupe_list_file:area_name # don't insert any comments to config file for i in `cat $CONFIG` do DIR=`echo $i|awk -F: '{print $1}'` DUPES=`echo $i|awk -F: '{print $2}'` AREA=`echo $i|awk -F: '{print $3}'` if [ -z "$DIR" -o -z "$DUPES" -o -z "$AREA" ] then echo "$0: error in config file $CONFIG" exit fi echo -n >>$DUPES if ! [ -f $DUPES ] then echo "$0: unable to open file $DUPES" exit fi OLDDIR=`pwd` # FIXME: use pushd ;-) if ! cd $DIR then echo "$0: unable to change directory to $DIR" exit fi if ls * >/dev/null 2>/dev/null then for j in * do if ! grep -w "$j:`sum <$j|awk '{print $1}'`" $DUPES >/dev/null 2>/dev/null then echo "$j:`sum <$j|awk '{print $1}'`" >>$DUPES $GTIC -h -a $AREA -f $DIR/$j echo -n|mail -s "autohatcher: $DIR $AREA $j" $SYSOP >/dev/null 2>/dev/null fi done fi cd $OLDDIR done