[Ilugc] Cron job execute query

  • From: bharathi@xxxxxxxxxx (bharathi)
  • Date: Sat Jan 8 04:01:36 2005

Anandh G wrote:

what I want is, I want the
sarg script to be run before the logrotate so that the
report for the previous day will be generated and the
log file will be rotated.
    I saw a 0anacron file in this dir which says
adding a 0 infront of the file will make this to
execute first before any other cron files. How can do
the same for sarg.

 

(1)Set  logfile_rotate  in your  squid.conf  then, create
FILE:  /etc/cron.daily/sarg
-----------------------

#!/bin/bash
 
#Get yesterday date
YESTERDAY=$(date --date "1 day ago" +%d/%m/%Y)
 
/path/to/sarg -o /DOCUMENTROOT/TO/REPORT/daily -d $YESTERDAY > /dev/null 2>&1

/path/to/squid -k rotate  
 
exit 0
-----------------

(2) Move squid logrotate config file from /etc/logrotate.d/squid  to /somewhere/

FILE:  /etc/cron.daily/sarg
-----------------------

#!/bin/bash
 
#Get yesterday date
YESTERDAY=$(date --date "1 day ago" +%d/%m/%Y)
 
/path/to/sarg -o /DOCUMENTROOT/TO/REPORT/daily -d $YESTERDAY > /dev/null 2>&1

/path/to/logrotate  /somewhere/squid 
 
exit 0
-----------------

this link may help you much.
http://sarg.sourceforge.net/sarg.php -->*Sarg users implementations 

*Thanks,
bharathi.


-- 
S.Bharathi Raja,
AU-KBC Research Centre,
M.I.T. Campus of Anna University,
Chromepet,
Chennai 600 044. INDIA
Phone: 91 44 22234885, 22232711 Ext:34
Fax: 22231034

Mail: bharathi@xxxxxxxxxx
      bharthix@xxxxxxxxx
Web : www.bharthix.tk

Other related posts: