tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* addendum to ifalias script
@ 2000-07-29 20:26 Alan C. Davis
  0 siblings, 0 replies; only message in thread
From: Alan C. Davis @ 2000-07-29 20:26 UTC (permalink / raw)
  To: tru64-unix-managers

Addendum to ifalias script posting.

Sorry for the omission. This is the content of site.rc and
site_lib.sh used by the ifalias script posted yesterday.


  # site.rc -- this file holds site specific env vars 
  # and is referenced by various scripts 
  # this file must use only the sh(1p) subset of sh/ksh syntax

  # the name of the script executing stripped of the path
  # this needs to be before the check for site.rc in each script
  # PROGNAME=${0##[./]*/} # ksh only
  # PROGNAME=`/usr/bin/basename $0` 

  # set hostname for single user mode
  HOSTNAME=`/usr/sbin/rcmgr get HOSTNAME | /usr/bin/cut -f1 -d'.'`
  export HOSTNAME

  # locations of scripts and programs
  SBINDIR=/local/bin
  BINDIR=/usr/local/bin
  ETCDIR=/local/etc
  export SBINDIR BINDIR ETCDIR

  # admin email
  ADMIN_EMAIL=sysadmin
  export ADMIN_EMAIL

  # pagers : used by critpage
  PAGER1="`/usr/bin/cat /local/etc/oncall_admin.txt`"
  PAGER2=xyz@mobilecomm.net
  export PAGER1 PAGER2


  # Set node-specific env variables and functions
  if [ -r /local/etc/node.rc ]
  then
	  . /local/etc/node.rc
  fi

  # Get common functions for site
  if [ -r /local/etc/site_lib.sh ]
  then
	  . /local/etc/site_lib.sh
  fi
  ---------- cut here ------------------------------

# site_lib.sh
######################################################################
# common functions
######################################################################
# paging functions assume an email gateway to the pagers

# display an error message
perror () {
	msg=$1
	echo "$PROGNAME : $msg"
}

# page the critical pagers
# usage : critpage severity "message"
critpage () {
	severity=$1
	msg=$2

	oncall=`cat /local/etc/oncall_admin.txt`

/usr/bin/mailx -r pager@tessco.com -s "$HOSTNAME" $oncall <<EOF
h=$HOSTNAME
p=$PROGNAME
$severity
$msg
EOF
echo "
----- Critical Page Event
Date: `date`
To: $oncall
Node: $HOSTNAME
From: $PROGNAME
Severity: $severity
Message: $msg
-----" >>/var/adm/critpage.log
}

# mail error event status
# usage : critmail severity "recipients" "message" [file]
critmail () {
	severity=$1
	maillist=$2
	msg=$3
	data=$4
	oncall=`cat /local/etc/oncall_admin.txt`

if [ -z "$4" ]
then
	/usr/bin/mailx -s "$severity : $HOSTNAME : $PROGNAME $msg" $maillist <<EOF
$HOSTNAME
$PROGNAME
$msg
EOF
else
	/usr/bin/mailx -s "$severity : $HOSTNAME : $PROGNAME : $msg" $maillist < $data
fi
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-07-29 20:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-07-29 20:26 addendum to ifalias script Alan C. Davis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox