man subject




NAME

  subject - generate a mail subject in a standard format


SYNOPSIS

  subject [-d] Priority Program Host Status Misc_info


DESCRIPTION

  The subject script is distributed with uaxtools and used by several tools to gener-
  ate a mail subject in a standard form.

  This script could be much more sophisticated, but was well established at ARSC when
  most of the uaxtools were written.  If sites choose to develop their own, things to
  consider including:
    Additional priorities, minimally failure
    Option to identify log
    Option to email log with subject
    Option to specify email addresses
    Option to log generated subjects and logs

  The thing to consider is managing email and especially managing anomalies.

  The script requires 4 arguments:

  Priority
         one of following numric values:
           0 success, subject will start ":  :"
           1 warning, subject will start ":>>:"
           2 error,   subject will start ":!!:"

  Program
         typically the script name.

  Host   typically `hostname -s`.

  Status numeric value (return code).

  Misc_info


OPTIONS

  -d     specify debug (error messages will be emailed).


NOTES

  Typical usage:
    #!/bin/bash
    unset SCR0 SCRP HOST WAMI PRI STS MAILSUB
          SCR0="$0"; SCRP="${SCR0##*/}";
          HOST=`hostname -s`
          WAMI=`whoami`
          check_daily >/tmp/check_daily.log 2>&1
          STS=$?
    if [ 0 = $STS ]; then PRI=0; else PRI=1; fi
          MAILSUB="`subject $PRI $SCRP $HOST $STS \"Additional Information\"\`"
          cat /tmp/check_daily.log | mailx -s "$MAILSUB" $WAMI
          exit $STS


ACKNOWLEDGEMENTS

  Written at the University of Alaska.  Ongoing maintenance via SourceForge by Denali
  Sun Consulting.

  Suggestions or bug reports can be directed to denalisun907@gmail.com.


RELATED INFORMATION

  See: uaxtools(8), push(8).