104 lines
1.5 KiB
Bash
Executable File
104 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
|
|
ch_etc()
|
|
{
|
|
|
|
if p=`grep "^archie:" /etc/passwd` ; then
|
|
archiehome=`echo $p | awk -F: '{print $6}'`
|
|
elif p=`ypmatch archie passwd` ; then
|
|
archiehome=`echo $p | awk -F: '{print $6}'`
|
|
fi
|
|
|
|
cd $archiehome/etc
|
|
|
|
}
|
|
|
|
|
|
MAIL_PGM=/usr/ucb/mail
|
|
ARCHIE_USER=archuser
|
|
|
|
|
|
MAIL_PREFIX=mail
|
|
|
|
|
|
RES_FILE=$MAIL_PREFIX.results
|
|
ADD_FILE=$MAIL_PREFIX.add
|
|
DEL_FILE=$MAIL_PREFIX.delete
|
|
SUC_FILE=$MAIL_PREFIX.success
|
|
FAI_FILE=$MAIL_PREFIX.fail
|
|
PAR_FILE=$MAIL_PREFIX.parse
|
|
RET_FILE=$MAIL_PREFIX.retr
|
|
|
|
|
|
ch_etc
|
|
|
|
if [ -w $RES_FILE ] ; then
|
|
|
|
cp /dev/null $RES_FILE
|
|
|
|
(
|
|
if [ -r $RET_FILE ]; then
|
|
echo " ";
|
|
echo " ";
|
|
echo "Failed retrieve:";
|
|
echo " ";
|
|
echo " ";
|
|
cat $RET_FILE
|
|
fi
|
|
if [ -r $PAR_FILE ]; then
|
|
echo " ";
|
|
echo " ";
|
|
echo "Failed parse:";
|
|
echo " ";
|
|
echo " ";
|
|
cat $PAR_FILE
|
|
fi
|
|
if [ -r $ADD_FILE ]; then
|
|
echo " ";
|
|
echo " ";
|
|
echo "Sites added:" ;
|
|
echo " ";
|
|
echo " ";
|
|
cat $ADD_FILE;
|
|
fi
|
|
if [ -r $DEL_FILE ]; then
|
|
echo " ";
|
|
echo " ";
|
|
echo "Sites deleted:";
|
|
echo " ";
|
|
echo " ";
|
|
cat $DEL_FILE;
|
|
fi
|
|
if [ -r $SUC_FILE ]; then
|
|
echo " ";
|
|
echo " ";
|
|
echo "Successful updates:";
|
|
echo " ";
|
|
echo " ";
|
|
cat $SUC_FILE;
|
|
fi
|
|
if [ -r $FAI_FILE ]; then
|
|
echo " ";
|
|
echo " ";
|
|
echo "Failed updates:";
|
|
echo " ";
|
|
echo " ";
|
|
cat $FAI_FILE
|
|
fi
|
|
) >> $RES_FILE
|
|
|
|
sub="archie update results `date`"
|
|
|
|
cat $RES_FILE | mail -s "$sub" $ARCHIE_USER
|
|
|
|
rm -f $ADD_FILE
|
|
rm -f $DEL_FILE
|
|
rm -f $SUC_FILE
|
|
rm -f $FAI_FILE
|
|
rm -f $PAR_FILE
|
|
rm -f $RET_FILE
|
|
|
|
|
|
fi
|