Searching to behave which i think is rather fundamental, but getting never written a CRON job before, I am not necessarily sure how to pull off it. Essentially, I've got a simple DB query that I have written:

SELECT SUM(total) as totalDownloads FROM wp_podpress_statcounts

As you'd expect, this shows several. What Let me do, though, is produce a CRON that instantly runs this question every single day and transmits me the outcomes. I am monitoring day-to-day downloads of the podcast, and also the podPress wordpress plugin I am using leaves a great deal to be preferred within the metrics department. Ideally, Let me build my very own stats system however, my PHP is not quite as much as snuff.

Thanks ahead of time!

No requirement for PHP if you are using a couple of built-in UNIX tools:

To complete from commandline, while using MySQL commandline:

mysql -e 'SELECT SUM(total) as totalDownloads FROM wp_podpress_statcounts';

Either put a -u -p for that account information, or put a [cde] inside your homedir.

Mail it to yourself using UNIX mail(1):

~/.my.cnf

How to crontab for every day.

Perform a mysql -e 'SELECT SUM(total) as totalDownloads FROM wp_podpress_statcounts' | mail your.addy@host.com and enter both of these lines:

crontab -e

Just an FYI - there's another option you might take a look at - mysql occasions. Much like what you will have in MS SQL Server for instance. You will find some restrictions on you skill which means you would certainly wish to check individuals out first.

Take a look at: http://dev.mysql.com/doc/refman/5.1/en/events.html for more information.

Personally, I frequently write a spend script and employ cron as noted above.