#!/bin/bash

#write a new daily today.rm: runs daily as cron job

# first remove old files

rm /home/phone/sh/2day
rm /home/phone/sh/2day.rm

# make a text file of today's date

DATE=$(date +%b%d)
echo $DATE > /home/phone/sh/2day

# convert this to realmedia format using text to speech

/usr/bin/tex2real /home/phone/sh/2day

   #  here is the tex2real executable
   #  #!/bin/bash

   #  if [ -z "$1" ]; then
   #  echo usage is: tex2real textfile
   #  exit
   #  fi

   # NAME=$1
   
   # # first make a wav file
   # # the text2wave programme is installed with festival tts
   # /home/kate/speech/festival/bin/text2wave $NAME -o $NAME.wav
   # # then convert to .rm
   # /usr/local/bin/realproducer -i $NAME.wav -o $NAME.rm -a 2 -f 0 -z 0 -b "message" -ow
   # # cleanup
   # rm $NAME.wav

# put a new blank-message on server
# this message will read out today's date, followed by 'you have no more messages yet'

cp -f /home/phone/sh/2day.rm /home/phone/incoming/realmsgs400/concat.rm

NEWDATE="/home/phone/incoming/realmsgs400/concat.rm"
NOMORE="/home/phone/incoming/realmsgs400/nomore.rm"
TODAY="/home/phone/incoming/realmsgs400/upload/today400.rm"

         /usr/local/bin/rmeditor -i $NEWDATE -i $NOMORE -o $TODAY

# same script could ftp to server    
#     /home/phone/sh/4ftphone.sh

