~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
     This is not used and incomplete
     I wrote this before writing the R script 
       startListener()

     Keeping this for reference purposes only

     This *almost* works.  What it does not 
          have is the ability to check if the
          task is alerady scheduled

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


#!/bin/bash

# RboxRelay_Parse_Cron_Setup.sh
# Make sure to run 
#   chmod 755 /path/to/THIS_FILE.sh

## Which user to run this under
##   ie,  genearlly you or root 
USER=$(whoami)

## Where is python located?  (to find out, run:  which python)
PYTHON='/usr/bin/python'

## Full path to the python script for parsing the email
SCRIPT='/path/to/thisfile/RboxRelay_parse.py'
SCRIPT='/Users/rsaporta/git/misc/rscripts/utils/RboxRelay_Parse.py'

FILENAME="RboxRelay.txt"

## Whether or not cron should email a log file after executing
NO_EMAIL_CRON_LOG=true

if [ $NO_EMAIL_CRON_LOG = true ]
  then 
    LOG=">/dev/null 2>&1"
  else
    LOG=""
fi

CMD="$PYTHON $SCRIPT $LOG"

# touch $FILENAME
crontab -l > $FILENAME
echo "* * * * * * $CMD" >> $FILENAME
echo "* * * * * * sleep 28; $CMD" >> $FILENAME
crontab - < $FILENAME && rm $FILENAME

