David, Was this question addressed? > I tried to search the archives for this but I can't find it. (Not saying > it isn't there just I could not find it.) I have a table that tracks > events on a monthly and daily basis. Currently I am resetting the > appropriate fields to 0 on a daily and monthly basis (not fun). Is there a > way to set a command in the cron table to do this for me > automatically? Here are the details. > > db name: activity > daily field name: dr (needs to be reset to 0) > monthly field name: mr (same as above) > > I know how to tell cron the date/time I want an event to trigger, but I > don't know the syntax of the command to send. Any help would be appreciated.
Cron will allow you to put together shell scripts and work in other ways to achieve this. Will leave details to you/your system/your preferences. MySQL has a "batch mode". Once you know the terminology, a search of the manual will yield a ton of material. Check out: 3.6 Using mysql in Batch Mode for shell> mysql < batch-file (you will probably need to study this to work out a more sophisticated command line than that) For example: shell> mysql database < script.sql > output.tab which appears in section: 4.8.2 The Command-line Tool The DuBois book discusses batch mode and gives a shell script example on p76. Welling and Thomson discuss "file redirection" somewhat in passing on p195 and use it extensively, eg to set up new db/tbl definitions (if they detail it elsewhere I've failed to note it). Regards, =dn --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php