• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Create a cron job to collect and PM stats

Andy.N

Well-known member
#1
I would like to create a cron job to run a sql query to collect post/threads/like in a certain forum and PM it to a few people. The cron job is scheduled for every Sunday.

Does anyone know how do I go about it?
Thanks
 

Jake Bunce

XenForo moderator
Staff member
#2
Admin CP -> Tools -> Cron Entries -> Create New Cron Entry

Then you need to point it to a class and method for which you will need to create a PHP file.
 

Andy.N

Well-known member
#3
Admin CP -> Tools -> Cron Entries -> Create New Cron Entry

Then you need to point it to a class and method for which you will need to create a PHP file.
Way over my head, Jake.
Any examples to get started?

I was googling to help myself and it looks like just writing a script on the server and create a cron job would be easier?
 

Andy.N

Well-known member
#5
Admin CP -> Tools -> Cron Entries -> Create New Cron Entry

Then you need to point it to a class and method for which you will need to create a PHP file.
Hi Jake,
Here is the very simple piece of code I found online that does the queries and email SQL result as CSV attachment.
http://www.studio-owens.com/code/email-mysql-query-results-as-a-csv-file-attachment.htm

Would really appreciate if you can help with the steps of how to create a cron job that will run every Sunday.
Thanks very much.
 

ProCom

Active member
#7
Hey @Andy.N can you help the rest of us newbies and write up what you did?

Let's say I want to run a VERY simple command every night at 9:pm EST: cp file1.zip file2.zip

How would I set this up to run via xF admin panel?

The "Cron Callback:" confuses the heck out of me.

@Andy.N you mentioned the code provided everything you needed, but where did you put the code and how did you setup the cron?

Thanks!