#!/bin/bash
#
#    This script is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This script is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this script; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

#Change this pipe to reflect yours
pipe="/var/tmp/g15fifo"

while /bin/true;
do
    line1="`date | sed -e "s/^/TS \\\"/g" | sed -e "s/$/\\\"/g"`"
    line2="`uptime | sed -e "s/\s\s/ /g" | sed -e "s/\s\s/ /g"  | \
        sed -e "s/, load average: .*//g" | cut -d' ' -f 3-6 | sed -e "s/^/\\\"/g" | \
        sed -e "s/$/\\\"/g"`"
    line3="`uptime | sed -e "s/\s\s/ /g" | sed -e "s/\s\s/ /g"  | \
        sed -e "s/.*, load average:/load average:/g" | sed -e "s/^/\\\"/g" | sed -e "s/$/\\\"/g"`"
    line4="\"\""
    line5="`free | grep "Mem:" | cut -b1-40 | sed -e "s/^/\\\"/g" | sed -e "s/$/\\\"/g"`"
    line6="`free | grep "Swap:" | cut -b1-40 | sed -e "s/^/\\\"/g" | sed -e "s/$/\\\"/g"`"
    line="$line1 $line2 $line3 $line4 $line5 $line6"
    echo $line > $pipe
    sleep 10
done;


