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.