List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:November 30 1999 3:24pm
Subject:Re: I need to use a timer in mySQL
View as plain text  
In the last episode (Nov 30), KIBRIS Finans Bank Limited. said:
> From: Dan Nelson <dnelson@stripped>
> > In the last episode (Nov 30), KIBRIS Finans Bank Limited. said: 
> > > I prepared a project. MysQL stores the hits and time etc..I want
> > > mySQL to reset all the data in a field in every 6 hours.. How can
> > > I do this with mySQL?
> >
> > extarnal script kicked off every 6 hours via cron?
> 
> Hmm I don't understand  what u mean? The problem is, I am preparing a
> toplist with perl and mySQL stores the hit counts. I want to reset
> these hit counts to zero in each 6 hours...

Create a file, called "clearcounters", with something similar to this:

update counters_table set hitcount=0;

, or whatever SQL statement you need to use to zero out your counters. 
Then run 'crontab -e', and add this line:

0    0,6,12,18    *    *    *    mysql mydatabase < /path/to/clearcounters

This will run that mysql script every 6 hours.  "man crontab" for more
info on how to schedule commands.

-- 
	Dan Nelson
	dnelson@stripped
Thread
I need to use a timer in mySQLKIBRIS Finans Bank Limited.30 Nov
  • Re: I need to use a timer in mySQLDan Nelson30 Nov
  • Re: I need to use a timer in mySQLKIBRIS Finans Bank Limited.30 Nov
  • Re: I need to use a timer in mySQLTonu Samuel30 Nov
    • Re: I need to use a timer in mySQLVivek Khera30 Nov
Re: I need to use a timer in mySQLKIBRIS Finans Bank Limited.30 Nov
  • Re: I need to use a timer in mySQLDan Nelson30 Nov