#!/bin/bash # fcisdlogrotate # # $Id: fcisdlogrotate 1090 2008-06-13 20:00:03Z jhealy $ # # This script takes the existing FC InetSvcs log file, moves it # to an archive directory, and compresses it. This script should # be called just BEFORE InetSvcs starts; you may use the hooks # provided in the FC startup scripts to do this. # # This script is non-destructive; it does not move or delete any # files (we rely on fcisd to roll the log file for us). # # compressor to use on log file COMPRESSOR="nice -n 20 /usr/bin/bzip2" # original log file LOGFILE="/Library/FirstClass Server/fcisd.log" # directory to store archived logs ARCHIVES="/Volumes/Backup/Logs/fcisd" #### #### Don't edit below this mark unless you know what you're doing #### # get current date and time to name the log file DATE=`/bin/date +%Y-%m-%d.%H-%M-%S` # compute the destination log name DESTLOG="${ARCHIVES}/fcisd.log.${DATE}" if [ -f "${LOGFILE}" ]; then echo "fcisdlogrotate: Saving copy of logfile with date ${DATE}" cp "${LOGFILE}" "${DESTLOG}" echo "fcisdlogrotate: Compressing logfile in the background" ${COMPRESSOR} "${DESTLOG}" & else echo "fcisdlogrotate: No logfile to save (${DATE}); skipping" fi