#!/bin/sh
#
# source:
#   $Source: /var/cvs/hosts/quoininc/smoke/etc/cron.daily/lprng,v $
#
# revision:
#   @(#) $Id: lprng,v 1.1 1998/01/11 02:19:10 jplejacq Exp $
#
# copyright:
#   Copyright (C) 1997 Jean Pierre LeJacq <jplejacq@quoininc.com>
#
# description:
#   Host configuration of cron daily program for lprng.
#
#   Reports warnings or errors using the syslog facility.  If there
#   are no errors, removes junk files older than a day.


# filter defining what errors to look for:
CS_WARN="Warning"
CS_ERROR="lp\:  Need to fix"

CS_DENY="${CS_WARN}|${CS_ERROR}"


# filter defining which errors you'll accept:
CS_LOCK_OWN="Warning - owner/group of ./var/lock. are 0/0, not 7/7"
CS_LOCK_PERM="Warning - permissions of ./var/lock. are 041777, not 042700"
CS_MISS_LOCKFILE="Warning -   LPD Lockfile .* does not exist!"

CS_ALLOW="${CS_LOCK_OWN}|${CS_LOCK_PERM}|$CS_MISS_LOCKFILE"


# main:

  if [ -x /usr/sbin/checkpc ]
  then

    /usr/sbin/checkpc | grep -E "${CS_DENY}" | grep -q -v -E "${CS_ALLOW}" ; RV=$?
    if [ "$RV" = "0" ]
    then
      /usr/bin/logger -p "lpr.err" -t "lpd" "cron.daily found errors, run checkpc for details."
    else
      /usr/sbin/checkpc -r -A 1D
    fi
  fi

exit 0


