#!/usr/bin/ksh
#
# svc_view_logfile.sh - view the logfile of a service
#
# Usage: 
#   svc_view_logfile.sh FMRI [...]
#
# Author: 
#   Bernd Schemmer, Bernd.Schemmer@gmx.de
#
# History:
#    08.04.2006 /bs  initial release
#

if [ "$1"x = ""x -o "$1"x = "-h"x ] ; then
  echo "Usage: $( basename $0 ) FMRI [...]"
  exit 2
fi

while [ $# -ne 0 ] ; do
  LOGFILE="$( svcprop -p restarter/logfile $1 )"
  echo " ----------------------------------------------------------------------------- "
  echo "Reading the logfile of the service \"$1\" ..."

  if [ $? -eq 0 -a "${LOGFILE}"x != ""x ] ; then
    view "${LOGFILE}"
  else
    echo "ERROR: Can not find a logfile for the service \"$1\" "
    [ $# -eq 1 ] && return
    echo "Press return to continue ..."
    read dummy
  fi
  shift
done




##############################################################################
### This script is submitted to BigAdmin by a user of the BigAdmin community.
### Sun Microsystems, Inc. is not responsible for the
### contents or the code enclosed. 
###
###
### Copyright 2006 Sun Microsystems, Inc. ALL RIGHTS RESERVED
### Use of this software is authorized pursuant to the
### terms of the license found at
### http://www.sun.com/bigadmin/common/berkeley_license.html
##############################################################################



