#!/usr/bin/env python
#
# Copyright C 2001-2007 by Isilon Systems, Inc. All rights not expressly
# granted herein are reserved.
# Created in the United States of America.
# 
# This digital media is protected by U.S. and international copyright and
# intellectual property laws. Unless otherwise specified, all information
# and screens appearing as part of this digital medium, including
# software, services, documents, text, images, icons, and logos design;
# the selection, assembly, arrangement, and design thereof; and the code
# that enables its presentation, are the sole property of Isilon Systems,
# Inc.
# 
# Except as otherwise required by applicable law, no part of any
# copyrighted material may be reproduced, modified, translated,
# distributed, published, or transmitted by any means, electronic or
# mechanical, for any purpose, without the prior written consent of Isilon
# Systems. 
#  
# Isilon and Isilon Systems are registered trademarks of Isilon Systems,
# Inc.  Legion is a trademark of Isilon Systems, Inc.  All other
# trademarks and registered trademarks are the property of their
# respective holders.
#
# $Id: isi_send_quota_notify 66073 2007-03-18 21:24:11Z ndire $

import sys

import isi.app.lib.quota_notify as qn

from syslog import openlog, syslog, LOG_ERR

openlog("isi_quota_notify_d")

if len(sys.argv) != 4 or sys.argv[1] != '-f':
    print >> sys.stderr, '%s: For internal use only.' % sys.argv[0]
    sys.exit(2)

email = sys.argv[2]
template = sys.argv[3]

try:
    qn.send_email(email, template)
except Exception, e:
    syslog(LOG_ERR, "Error sending %s to %s: %s" % (template, email, e))
    sys.exit(1)

sys.exit(0)
