Code: Select all
#!/bin/bash
# Script to start logging if both a Jaguar (to log from) and flash drive (to log to) are
# available.
# Set variables
jaguar="/dev/ttyUSB.Jaguar"
media="/dev/ttyUSB.Flash"
loglocation="/media/pi/LOGS/LOGS_FreeEMS"
ulv="/usr/bin/ulv"
# Confirm that everything is present and act accordingly
if [ -e $jaguar -a $media -a $loglocation ];
then
logger "Ultimate Loader requirements met. Onward and upward!"
$ulv watch $jaguar &> $loglocation/`date '+%Y%m%d%H%M-FreeEMS-TOXICTACOMA'`.log
exit 0
else
logger "Ultimate Loader requirements NOT met. Review: `echo $jaguar`"
logger "Ultimate Loader requirements NOT met. Review: `echo $media`"
logger "Ultimate Loader requirements NOT met. Review: `echo $loglocation`"
exit 1
fi