24 lines
436 B
Bash
Raw Normal View History

#!/bin/sh
start () {
if [ -z $FILE_LOCATION ]; then
echo "Error: file reporter requires \$FILE_LOCATION to be specified"
2015-03-22 18:01:27 +01:00
return 1
fi
if [ ! -f $FILE_LOCATION ]; then
touch $FILE_LOCATION
fi
}
2015-03-14 13:32:26 +01:00
report () {
local metric=$1
local value=$2
local datetime=$(iso_date)
echo "$datetime $metric: $value" >> $FILE_LOCATION
2015-03-14 13:32:26 +01:00
}
docs () {
echo "Write to a file or named pipe."
echo "FILE_LOCATION=$FILE_LOCATION"
}