###
### Modified to run this script for frost/snow/blue/white IBM systems
### By                    V. Krishna Kumar NCO/Date: December 27, 2004
###
# LOG:
# J Carr/F Achorn    05/17/2006    Simplified script to just copy sdmedit file
#                                  to the other machine   
set -uaxs
DATA=/ptmp/$LOGNAME/edtlst
mkdir -p $DATA
cd $DATA
user=`whoami`
This_machine=`hostname | cut -c 1`
#if [ $This_machine = "m" ]; then
#   Other_SP="dew"
#else
#    Other_SP="mist"
#fi
#
if [ $This_machine = "s" ]; then
   Other_SP="cirrus"
else
    Other_SP="stratus"
fi
#

export DBNROOT=/gpfs/${This_machine}/nco/ops/dbnet
DBNR=$DBNROOT/bin/move_sdmedit

REJX=/dcom/us007003/sdmedit
REJN=$DATA/newlist
REJC=$DATA/coplist
cp $REJX $REJN    
cp $REJN $REJC    

vi $REJN; RC=$?

diff $REJC $REJN >/dev/null 2>&1; DN=$?
diff $REJC $REJX >/dev/null 2>&1; DX=$?

if [ $DN -eq 0 ] 
then
   echo "Not updating the reject list because no changes were made."
   exit
elif [ $DX -ne 0 ] 
then
   echo "Not updating the reject list because someone else has changed it."
   exit
else
   chmod 664 $REJN
   $DBNR $REJN
fi
 
echo "VILST WILL NOW ATTEMPT TO UPDATE REJECT LIST ON ${Other_SP}."
echo "If this process hangs "ctrl-c" will kill it."

# COPY SDMEDIT PERMANENT DELETE LIST TO THE OTHER MACHINE
echo "Copying ${REJX} to ${user}@${Other_SP}:${REJX}"
scp ${REJX} ${user}@${Other_SP}:${REJX}
exit

