#!/bin/sh
#
# (C) R. J. Livermore  1995-1999
# (C) Livermore Software Laboratories, Inc. 1995-1999
#
# NOTICE TO USERS OF SOURCE CODE EXAMPLES
#
# FAS PROVIDES THE SOURCE CODE EXAMPLES, "AS IS" WITHOUT WARRANTY OF ANY
# KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED
# WARRANTIES OR MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE
# ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOURCE CODE EXAMPLES
# IS WITH YOU.  SHOULD ANY PART OF THE SOURCE CODE PROVE DEFECTIVE, YOU
# (AND NOT FAS OR AGENT OF FAS) ASSUME THE ENTIRE COST OF ALL NECESSARY
# SERVICING, REPAIR OR CORRECTION.
#
# file:  /usr/local/etc/refresh_httpd
#
# This script kills and restarts /usr/local/etc/httpd
# and rotates the logs /var/adm/access_log and /var/adm/error_log
# appending the date to the name of the rotated logs.
#
# cron can be configured to automate the script.  To do so,
# insert a line at the bottom of /usr/spool/cron/crontabs/root specifying
# the download script and the time and date of download.  The first numer
# in a cron statement is minutes, the second is hours in military time, the 
# fifth is the day of the week, and everything after the day of the week
# is executed.  See example.
# example:
#		43 2 * * 1 /usr/local/etc/refresh_httpd
#
kill `cat /etc/apache/httpd.pid`
sleep 10
if [ "`uname`" = "Linux" ]; then
	mv /var/log/access_log /var/log/access_log.`date +%y%m%d`
	mv /var/log/error_log /var/log/error_log.`date +%y%m%d`
else
	mv /var/adm/access_log /var/adm/access_log.`date +%y%m%d`
	mv /var/adm/error_log /var/adm/error_log.`date +%y%m%d`
fi
/usr/local/etc/httpd
