Automate Listings Updates

Last updated on
30 April 2025

In order to get drealty to have listings updated automatically, you can set up a cron job to run the drush rets-import command.

Here is how:

Follow these instructions: http://drush.ws/docs/cron.html

Find the location of drush:

which drush

This will show something like this:

/usr/local/bin/drush

Show your $PATH

echo $PATH

This will show something like this:

/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

Now, using the above info let's structure our cronjob:

Here are some examples of cron jobs:

This one uses drush aliases.drushrc.php and will run everyday at 3:00am

0 3 * * *  /usr/bin/env PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin COLUMNS=72 /usr/local/bin/drush @DRUSHSITEALIAS -d rets-import

This next one uses drush --root and --uri and will run everyday at 3:00am

0 3 * * *  /usr/bin/env PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin COLUMNS=72 /usr/local/bin/drush --root=/home/USER/public_html --uri=www.YOURSITE.com -d rets-import

BONUS: this one only imports images marked for download using rets-process-images and will run every OTHER day at 1:00am

0 1 */2 * *  /usr/bin/env PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin COLUMNS=72 /usr/local/bin/drush --root=/home/USER/public_html --uri=www.YOURSITE.com -d rets-process-images

rets-process-images is good to run every other day, because image downloads take the longest, and you don't want cron jobs overlapping.

Also note, I did NOT set -u admin because that always returned 'Could not login with user account `admin'. I believe the issue is that you would ALSO have to supply the password -u admin -p PASS.

Here is an example crontab entry on a Debian GNU/Linux system:

0 3 * * * /usr/bin/env PATH=/usr/local/bin:/usr/bin:/bin COLUMNS=72 /usr/local/bin/drush --root=/var/www --uri=charlottesvillerealestate.us -u Charlottesville\ Real\ Estate -d rets-import

This will run the drealty rets-import at 3am every day of the year.

Notes

What does COLUMNS=72 do?

In short, it's the line-wrap character limit. You need this so cron doesn't error out due to long non breaking lines that it or the process it's running my not be able to handle.

Full answer from drush.ws

Setting COLUMNS
When running drush in a terminal, the number of columns will be automatically deteremined by drush by way of the tput command, which queries the active terminal to determine what the width of the screen is. When running drush from cron, there will not be any terminal set, and the call to tput will produce an error message. Spurrious error messages are undesirable, as cron is often configured to send email whenever any output is produced, so it is important to make an effort to insure that successful runs of cron complete with no output.

Help improve this page

Page status: Not set

You can: