#navigate to bluebot folder, change this if your location is different
cd ~/bluebot

# zip previous log files for this config
now="`date +%Y%m%d%H%M%S`"
current_log=log/bluebot_log.$1.txt
archive_log=log/bluebot_log.$1.$now.txt

if [ -f $current_log ]; then
    mv log/bluebot_log.$1.txt $archive_log
    zip -vu log/bluebot_logs.zip $archive_log

    # remove raw text files now that they're zipped
    rm $archive_log
fi

# finally launch bluebot and log output to log file as well as stdout
node bluebot config="config/user/$1.js" 2>&1 | tee $current_log
