Creating the Cron Job
We’ve now created all the parts to our MLS system, but we often need one more finishing touch, a scheduled job to keep our listings up to date. To do so we first need to uncomment a couple lines in each batch file we created. Uncomment “UPDATE_BCF” and “UPDATE_ONLY” so it looks like the following:

Now we have two options. You can create a cron job for each individual batch, or we can create a very simple shell script to kick them all off one after another. Then we only need to create one cron job to execute that shell script. Here’s what your shell script(or bat for Windows) should resemble(just create a file name retscronjob.sh):
#!/bin/sh
#
# execute this to update all feeds to database with cron job
#
cd /PathToVieleRETS/vieleRETS
php -q ./run_interactive_job.php batch_control_files/MyBatch
echo Updated MyBatch
php -q ./run_interactive_job.php batch_control_files/AnotherBatch
echo Updated AnotherBatch
Be sure to replace PathToVieleRETS and MyBatch respectively. Now our only cron job will be to execute this script: /pathToCronJob/retscronjob.sh. There you have it, a 6 step tutorial to completely handle all of your RETS MLS needs from retrieving the feed to creating a scheduled download!
- RETS Retrieval with PHP and VieleRETS: Part 1, Introduction
- RETS Retrieval with PHP and VieleRETS: Part 2, Creating a Source
- RETS Retrieval with PHP and VieleRETS: Part 3, Creating a Target
- RETS Retrieval with PHP and VieleRETS: Part 4, Creating an Extract
- RETS Retrieval with PHP and VieleRETS: Part 5, Executing the Batch
- RETS Retrieval with PHP and VieleRETS: Part 5, Creating a Cron Job
Related posts:


28 Responses
Anu
13|Jul|2009How can I edit batch control file for running the cron job ? I need to uncomment QUIET and UPDATE_BCF tags and need to set the limit to 0… can you tell me how I can do it ???
Anu
13|Jul|2009How can I edit batch control file for running the cron job ? I need to uncomment QUIET and UPDATE_ONLY tags and need to set the limit to 0… can you tell me how I can do it ???
trent
14|Jul|2009You mean doing it dynamically? I dont know how to go about that, I wound up creating multiple batch files, one for each I needed to do
Anu
16|Jul|2009Trent,
No what I mean is I learned that when you download listings with cron , to get the errors ,you should uncomment the tag QUIET and to get updates alone uncomment the tag UPDATE_ONLY. I just want to know how we can do it manually ? I tried editing it.. But couldnt..
trent
17|Jul|2009That should be all you have to do from my understanding.. there may be a bug with newer versions.. its been so long since I’ve used it
James
17|Feb|2010Thanks Trent, this tutorial was extremely helpful. One thing though. Will I need to somehow query for delete or expired properties to clean out my database of old properties or should rets take update the list status? Thanks,
James
trent
17|Feb|2010I’m not positive if VieleRETS handles this or not. I don’t believe it would be handled on the RETS end, but rather VieleRETS or which ever client you use should handle it.
Anu
05|Mar|2010Hello Trent,
how can we check if the cron file is working and we get the updates.. is there any way to see that ?
thanks
Anu
trent
05|Mar|2010Anu,
The easiest way to check that your cron is working is to dump any output to a log file. This is pretty easy with crontab:
*/10 * * * * /bin/execute/this/script.sh 2>&1 >> /var/log/script_output.log
Here is some more detailed information on it:
http://kevin.vanzonneveld.net/techblog/article/schedule_tasks_on_linux_using_crontab/
You could also have the output emailed to yourself, but that can get annoying..
Anu
08|Mar|2010Trent,
for the version 1.1.8 , is this the login url http://retsgw.flexmls.com/rets2_0/Login >? i am not able to login to the rets sever using the same username and pass which i used in version 1.1.7 ?
trent
08|Mar|2010Anu,
The login url is vendor specific and your mls provider should give you the proper url and login username/password.
Anu
09|Mar|2010Hello Trent,
i have a vieleRETS set up. The last download i have done was months ago.. and today i tried to download the new listings but nothing new added….. and it says No listings were found.. is there any chance that there can’t be any new listings in thesee months or i got into some errors ?
Anu
10|Mar|2010when I download listings I get ” RETS Server: Invalid field (UNUSEDFIELD115) in select parameter. ” how can i fix it ?
trent
10|Mar|2010sounds like you have a field defined in vielerets that doesn’t exist on the RETS Server. Are you defining a field called “unusedfield115″?
Anu
10|Mar|2010yes .. In the datamap , there we got a field with that name..
Anu
11|Mar|2010Trent,
can we download listings from a given date.. means if i want to download all the listings from 1st january 2010, how can i do that ?
pls reply me
trent
11|Mar|2010That may be better suited to ask someone with your RETS provider. I have never had to do this.
retsman@gmail.com
24|Jun|2010Trent Richardson, This tutorial is in my humble opinion, perfect. I don’t think I have ever used that word with Anything relating to rets development to date, but you got it. Thanks man, I didn’t have to look anywhere else or google to try and find forums about rets development [there aren't many], nice work.
Eric Nickus
Sean Coleman
14|Jul|2010Trent – First of all, thanks for an amazing tutorial. I don’t think I could have setup and gotten VieleRETS working properly without it. However, I’m running into a problem right now with updating listings. The process doesn’t seem to update any listings (with changes such as price). It downloads new listings fine, but existing listings never get data updated. In the stack trace, it shows all listings being loaded and says some are “existing listings” and aren’t downloaded. If I manually delete a listing from the database, it will redownload it, but I don’t want to have to delete all listings in the database before doing daily downloads. Any thoughts? Thanks so much.
Ron Bigus
08|Aug|2010Sean,
I believe your problem is in the Source setup, under Fields that determine what is new.
You need to check some more boxes, like price change, listing status etc… whatever you want to update .
Ron Bigus
08|Aug|2010Sean, I should have said, Source setup, Dependent Settings, Fields that determine what is new.
Nate
19|Aug|2010Thanks for a great tutorial Trent.
Suddenly my VieleRets installation only downloads HALF of available/new listings. I wasn’t sure why only some of my listings were being downloaded, but when I noticed it’s EXACTLY HALF everytime, I figured there must be a bug in the system. Any ideas?
Thanks.
Terry Harmon
17|Oct|2010Great article Trent! One thing that might confuse people about creating your shell script is if you create it on a windows or mac machine, you will get a “bad interpreter” error when you try and execute the script on a linux server.
There’s an easy fix. Use vi. example commands:
vi
when the shell script pulls up type: “:set fileformat=unix” hit enter
then exit the program: “:wq!”
Knowing that could save you hours of frustration :)
sendil
16|Nov|2010hello trent. can you help me how to install open house in veilerets?
please tell me step by step
trent
17|Nov|2010Hey sendil,
I’ve never used open house, and I’ve not used veilrets in quite some time. I know there have been several major updates since I used it last. Hopefully your comment on here will draw the attention of someone who has. Also be sure to check the vielerets mailing list as it is very helpful!
sendil
24|Feb|2011hello Trent. how are you. I have completed successfully. Thanks for your useful information
http://www.webbeez.com
drew
23|Mar|2011Hello Trent, no batch files are created when I create a new extract. I’m running 1.1.8. Do you have any idea why I wouldnt get one?
thanks,
Drew
trent
29|Mar|2011Hey Drew,
I’ve not messed with any of the newer versions unfortuantely.. :/