#!/bin/sh
set -u  
if [ "${1:-}" = "-x" ] ; then set -xv; shift; fi

tickets=/home/enstore/FARenstore-opens-forISAgroup

if [ ! -r $tickets ]; then exit 0;fi

python $ENSTORE_DIR/bin/helpDeskTicket.py $tickets
rc=$?
if [ $rc != 0 ]; then echo "trouble $rc"; exit $rc; fi
rm -f $tickets

chmod 666 FARenstore-opens-forISAgroup.rtf
$ENSTORE_DIR/bin/`uname`/unrtf --text $tickets.rtf > $tickets.text
$ENSTORE_DIR/bin/`uname`/unrtf --html $tickets.rtf > $tickets.html

mv $tickets.* /fnal/ups/prd/www_pages/enstore/
exit 0


###      Here is the .forward that is needed:
###      
###      | /usr/bin/procmail
###     
###     
###     
###      Here is the .procmail that is needed:
###      
###      VERBOSE=on
###      HOME=/home/enstore
###      PATH=/usr/krb5/bin/rcp:/bin:/usr/bin:/usr/local/bin
###      
###      
###      MAILDIR=${HOME}/MAIL
###      MAILNEW=${MAILDIR}/inbox
###      DEFAULT=$MAILDIR/inbox
###      LOGFILE=${MAILDIR}/logfile
###      LOCKFILE=${HOME}/.lockmail
###      
###      :0
###      * ^From:.*Seagate Information.*
###      /home/enstore/FARenstore-opens-forISAgroup
###      
###      :0
###      * !^From:.*Seagate Information.*
###      ! enstore-admin@fnal.gov
