#!/bin/sh

# Copyright (C) Freemont Avenue Software, Inc. 1996-1999. All rights reserved.

#
# Continuously display security alerts
#

PATH=/usr/sbin:/usr/bin:/bin
export PATH

# System dependent parameters
os=`uname`
if [ "$os" = "AIX" ]; then
  xterm=/usr/bin/X11/aixterm
  logfile=/var/adm/syslog
elif [ "$os" = "HP-UX" ]; then
  xterm=/usr/bin/X11/hpterm
  logfile=/var/adm/syslog/syslog.log
elif [ "$os" = "SunOS" ]; then
  xterm=/usr/openwin/bin/xterm
  logfile=/var/adm/messages
elif [ "$os" = "Linux" ]; then
  xterm=/usr/X11R6/bin/xterm
  logfile=/var/log/messages
else
  echo "Unsupported operating system"
  exit
fi

# Colors, geometry, etc. may be customized
opts="-fg red -bg white -geometry 132x12 -sb -sl 500"

# Test for X and display log
if [ ! -z "$DISPLAY" ]; then
  $xterm $opts -title "security alerts -display $DISPLAY (tail -f $logfile | grep Security)" -n alerts -e sh -c "tail -f $logfile | grep Security" &
else
  tail -f $logfile | grep Security
fi
