#!/bin/sh
#                                          last update: 28.10.01
# /secure/hourly
#
# Function: root crontab hourly entries, all output is to stdout.
#
# History: 31.01.01 sean boran: clean up for general use
#          25.02.02 If ntpd is running don't sync time
#

## Watch for SYN flooding:
#/secure/monitor_tcpsync.sh

## Send queued messages, if any:
## (not needed is sendmail running in Qing mode - ie. with Jass 0.31)
/usr/lib/sendmail -q

## check that no disks are full
#sh  /secure/check_disk 90 180

## Time sync.
## If NTP server is running, skip
NTPCHECK=`/usr/sbin/ntpq -c as 2>&1` 
if [ -z "$NTPCHECK" ] ; then

  ## Is this a timehost? If yes, don't sync either
  grep `uname -n` /etc/hosts | grep -c timehost >/dev/null
  if [ "$?" != "0" ] ; then
    ## Sync via Network Time protocol
    #ntpdate timehost > /dev/null 2>&1
    ## Sync time via the simple rdate/inetd mechanism: (ignore errors)
    /usr/bin/rdate timehost > /dev/null 2>&1
    ## on linux, use 'netdate':
    #netdate timehost > /dev/null 2>&1
  #else 
  #  echo "This is a timehost, no manual syncing needed"
  fi
fi

#eof
