#!/bin/csh -f
# These next two definitions need to be configured for each user!
set datDir = /tmp/autoSend
set binDir = /usr/local/bin
# OK, all standard stuff now...
echo ""
echo "AutoSend run started `date`"
set dateID = `date | awk '{printf "%s%s\n",$2,$3}'`
cd $datDir
if ( -f autoSend.dat ) then
  # FORMAT OF DATA FILE:
  # <user> <file> FULL|<patchParts> <otherSwitches>
  #	...or...
  # *LIST* <user> <number_to_send> <otherSwitches>
  echo "#\!/bin/csh -f" > mkList.sh
  echo "set nextAuto = $datDir/autoSend.next" >> mkList.sh
  awk -f $binDir/mkList.awk autoSend.dat >> mkList.sh
  chmod +x mkList.sh
  mkList.sh > realList.dat
  cp realList.dat dataBack.${dateID}
  # FORMAT OF PROCESSED DATA FILE:
  # <user> <file> FULL|<patchParts> <otherSwitches>
  echo "#\!/bin/csh -f" > doList.sh
  awk -f $binDir/doList.awk realList.dat >> doList.sh
  chmod +x doList.sh
  doList.sh
  rm mkList.sh doList.sh autoSend.dat realList.dat
  if ( -f autoSend.next ) mv autoSend.next autoSend.dat
else
  echo "Nothing to send - makes MY job easy\!\!"
endif
echo "AutoSend run completed `date`"


syntax highlighted by Code2HTML, v. 0.9.1