Re: error in Cron

From: Brett Lymn <[email protected]>
Date: Thu, 27 Jan 2000 09:56:25 +1030 (CST)

According to Keith Kippen:
>
>Does anyone have any idea why this command runs when bashed but won't run once the time is added and run in Cron?
>

Because cron is running things under /bin/sh and it does not
understand bash syntax. You probably want to make a short shell
script that performs the rolling of the log for you and just call that
from cron. Below is a cut of a bit of a script that I use to roll the
logs in the manner that you want (actually, it is from a hacked over
version of a script from cache-stats):

#!/bin/sh
#
SQUIDDIR=/local/squid
SQUIDBIN=${SQUIDDIR}/bin
LOGDIR=${SQUIDDIR}/logs

DATE=`date +%Y%m%d`
LOGFILE=$LOGDIR/access.log.$DATE

echo "$SQUIDBIN/squid -k rotate (and sleeping 90 seconds) ..."
$SQUIDBIN/squid -k rotate
sleep 90
mv $LOGDIR/access.log.0 $LOGFILE

-- 
===============================================================================
Brett Lymn, Computer Systems Administrator, British Aerospace Australia
===============================================================================
Received on Wed Jan 26 2000 - 18:52:23 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:50:43 MST