#!/bin/sh
# @(#)cmsphonehome.sh	1.2	99/04/06 SMI
# /* Copyright (c) 1998, by Sun Microsystems, Inc.
# /* All rights reserved
# /*==========================================================================
# cmsphonehome - report a failure by phoning home
# 
# SYNOPSIS
# --------
# 'cmsphonehome' 'module' 'module_no' 'location' 'old_state' 'new_state'
#
# DESCRIPTION
# -----------
# 'cmsphonehome' is a script called by the CMS when any module fails. It is
# intended that this script can be altered to report module failures to an
# appropriate place. This could be to send a mail message or to communicate
# with an alarm system.
#
# The arguments passed to it are:
#	module		module type as known to the CMS
#	module_no	module no as known to the CMS
#	location	location of the module
#	old_state	previous state of the module befire the failure
#	new_state	current state of the module
#
# 'cmsconfig' can be used to read further information (attributes) from
# the CMS if required.
#
# The default script has an example of how to build up a mail message but
# this is commented out.
#
# SEE ALSO
# --------
# cmsconfig(1MFT)
# --------------------------------------------------------------------------*/

MOD_NAME=$1
MOD_NUM=$2
LOCATION=$3
OLD_STATE=$4
NEW_STATE=$5
TMP=/tmp/phonehome$$

MACHINE=`/usr/bin/uname -n`
# cat > $TMP << EOF
#
# Configuration change report
# ---------------------------
#
# module:       $MOD_NAME $MOD_NUM 
# location:     $LOCATION
# state change: from $OLD_STATE to $NEW_STATE
# machine name: $MACHINE
#
# Module service information:
#
# EOF
# echo "Last 50 lines of status log:\n" >>$TMP
# tail -50 /var/opt/SUNWcms/status_log >> $TMP
# #email $TMP to an appropriate recipient
# rm -f $TMP

# Ensure it returns success
exit 0
