##!/bin/bash #This script rotates the logs on the 30th of every month. #Before doing so it sends a rough count of apache hits to bjjgann and dbrown #It is run by the nightly backup script. #It assumes BB is shutdown when run (Our Nightly backup shuts BB down) #We run on LINUX #Jake Gannon bjjgann@liv.ac.uk theday=`date '+%d'` themonth=`date '+%m'` if [ $theday = "30" ] then #IF BB IS STILL RUNNING PUT SHUTDOwN CODE HERE grep $themonth /usr/local/blackboard/logs/httpd/access_log |wc > /tmp/a /usr/local/blackboard/tools/admin/RotateLogs.sh chown bbuser /usr/local/blackboard/logs/update-tools/update-tool-log.txt chgrp bbuser /usr/local/blackboard/logs/update-tools/update-tool-log.txt mail -s "Blackboard Logs Rotated" bjjgann < /tmp/a mail -s "Blackboard Logs Rotated" dbrown < /tmp/a rm /tmp/a #IF YOU SHUTDOWN BB RESTART IT HERE fi