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