C-Command Software Forum

Generate stats report from command line?

Is there a way to generate a stats report from the command line? I have a drone setup and I’d like to setup a cron job to send myself a stats report daily - to both see how it is doing and as a confirmation that the drone is functional.


There’s currently no feature to do this. If you tell me more specifically what you want to do, perhaps I can add a hook or additional scriptability in a future version.

In the meantime, some possibilities are:

  1. You could add AppleScript actions to Mail rules to track the number of spam and good messages being processed and write this information into a place where your cron script can access it.
  2. You may be able to observe the Growl notifications and react based on them.
  3. Your cron script could use the sqlite command-line tool to directly query SpamSieve’s History.db file. (This database format will be changing significantly in the next major version.)

Nothing fancy - just the ability to call something from a bash command line that will generate the current statistics output, that I can then pipe to email (or mail) to send to me daily. If I can do that I can set it up as a cron job for a regular report.

If it’s more involved than that, then I’d prefer to wait or not do at all.


OK, if you just want a single block of text with the current statistics report, that should be quick to add.

Basically just looking for the same output as I would get if I generate stats from the GUI. Text and line breaks, nothing fancy.

Yes, I’m referring to the text that you get if you click the Copy Stats button.

Perfect - will be happy to test it out if/when you have it ready.


Speaking of which, I just noticed a bug with the existing functionality. It appears that the copy stats button is not copying all the information that is displayed in GUI - see attached screenshot.

Screen Shot 2018-06-22 at 12.55.52 PM.png

It can take a long time to calculate the stats, so currently the Copy Stats button will copy the currently displayed values (or zeroes if they’ve not been calculated yet) rather than freezing until it’s finished recalculating.

SpamSieve 2.9.32 adds a new statistics report AppleScript property, which you could query from the command-line using osascript.

This is fixed in SpamSieve 2.9.32.