#!/bin/bash

ela_name=$1
if [ -z "$ela_name" ]; then
	echo "Usage:"
	echo "    ela_remove <rule_name>"
	exit 1
fi

uid=`id -u`
if [ $uid != "0" ]; then
	echo "ERROR: Only root is allowed to use the ela tools"
	exit 1
fi

EVLNOTIFY=/sbin/evlnotify

ela_id=`$EVLNOTIFY -s ${ela_name} | grep "^id=" | awk -F "=" '{print $2}'`
if [ -z "$ela_id" ]; then
	echo "ERROR: Can't find this '$ela_name' ela rule."
	exit 1
fi
$EVLNOTIFY -d ${ela_id}

