#!/bin/sh
echo [$$] [`date`] Starting >> /tmp/dhis-dummy-log-engine.log
while true
do
	read line
	echo [$$] `date` Received: $line >> /tmp/dhis-dummy-log-engine.log
	case $line in
	'exit')
		exit 0
		;;
	'reload')
		echo [$$] `date` RELOAD issued >> /tmp/dhis-dummy-log-engine.log
		;;
	esac

	cmd=`echo $line | awk '{ print $1 }'`

	case $cmd in 

	'add')
		echo [$$] `date` $line >> /tmp/dhis-dummy-log-engine.log
		;; 
	'update')
		echo [$$] `date` $line >> /tmp/dhis-dummy-log-engine.log
		;; 
	'delete')
		echo [$$] `date` $line >> /tmp/dhis-dummy-log-engine.log
		;; 
	esac
done
