Search

NOTE: I watched this helpful video on how Drupal uses Cron. Actually, the first half of this video, shows you how to setup Cron on your Mac or Linux machine (Windows developers, here’s a helpful tutorial on how to setup wget for Windows on your machines). The Drupal specific stuff on the back half of the video you can ignore.

Setting up Cron to run XML Importer

Step 1) Install the following extensions, XML Importer, Shell, Cron

Step 2) Setup your XML import through XML Importer.

Step 3) Edit crontab by going to your Terminal and run crontab -e

NOTES ABOUT THE EXAMPLES: The authentication token (auth-token) is 123e45f6 and the XML Importer name is testimport. You should replace these values with your values.

10 *    *   *   *   php /home/username/Sites/test.com/extensions/shell/bin/symphony -t 123e45f6 cron run-tasks

Step 4) In Symphony, go to the Cron menu option under System, click create new, to create new cron job on Symphony.

In the command line field in Cron, use the following, if curl is installed…

curl --silent --compressed http://test.com/symphony/extension/xmlimporter/importers/run/testimport/?auth-token=123e45f6

OR if wget is installed

wget -O - -q -t 1 http://test.com/symphony/extension/xmlimporter/importers/run/testimport/?auth-token=123e45f6

Then wait and see if it works. Or you can force it by going to your terminal, and typing in your command from the crontab

php /home/username/Sites/test.com/extensions/shell/bin/symphony -t 123e45f6 cron run-tasks

ALSO, since I’m no expert with Cron, please anyone add detail to this thread so it can be more helpful to others. Thanks for all of y’alls help.

Special thanks to the brains behind these extensions… @pointybeard (alistair), @buzzomatic (rowan), @nickdunn, @czheng, @allen, @nils, and everyone else in the community who develop all of the available extensions. Y’all truly are awesome! I hope one day to be able to develop a helpful extension. Thanks again!

Good explanation here Brian! I have no idea about how Cron works and have been thinking how I could get xml imported on a nightly feed basis. Spotted the Cron extension the other day, but hadn’t a clue how to implement it.

Now I know! Cheers…

Glad it’s a help.

This is pretty helpful, good job :) Maybe it could be polished up a bit and converted to an article or tutorial?

Certainly. Brian, if you want to give it a go, just email me the finished text and I’ll give it a once-over and then post it.

OK. When I have some time, I’ll be happy to write it up.

Are there advantages to using the Cron+Shell extensions over just putting the cron commands in your host’s crontab? I’ve already done the latter, but if this buys some extra functionality (or ease of maintenance) I’ll switch.

yeah, good question

For developers who are just handed a system and don’t have access, or for lazy bums like myself who can’t be bothered to leave the Symphony interface?

Actually, the Cron + Shell extensions as they are now (that I know), are not a crontab replacement. You still have to get into crontab and setup a cron job.

do they also support ‘poormans cron’ for those with limited cron features on a shared host?

Has anyone managed to get the above working in 2.2.1? The cron extension throws an error for me.

The cron extension throws an error for me.

What's the error?

Sorry, I had a permissions error. I didn't have the manifest/cron directory setup.

Hey guys,

I'm trying to run cron, ssh and xml importer on v2.2.2 (on a ubuntu 10.10 local environment).

Although, when forcing the crontab it is breaking in run-tasks.php.

php /var/www/vhosts/testing.local/httpdocs/extensions/shell/bin/symphony -t XXXXXXXX cron run-tasks

PHP Fatal error: Call to a member function create() on a non-object in /var/www/vhosts/holiday.local/httpdocs/extensions/cron/bin/run-tasks on line 16

The command, entered in Cron administration panel, works fine when entered directly into terminal.

curl --silent --compressed http://holiday.local/symphony/extension/xmlimporter/importers/run/sunshinecountries/?auth-token=a39880be

It updates the database as expected when it is bypassing the cron module.

I'll keep on looking into the issue but I'm afraid my difficulty is learning symphony while I do it. If anyone could help, or put forwards idea of what I may have done wrong, or which parts could of changed between 2.2.1 and 2.2.2 to cause the issue, I would appreciate it!

P.S. Big hugs for everyone on the Symphony wagon. You guys are a light in the darkness of web development. Glad to be on-board and hope to contribute where I can. :)

Continued

$driver = Shell::instance()->ExtensionManager->create('cron');

Its taken me about an hour to understand what was going on here. It works if I remove the line in run-tasks.php and include the classes at the top of the file instead.

requireonce(EXTENSIONS . '/cron/lib/class.crontask.php');
require
once(EXTENSIONS . '/cron/lib/class.crontaskiterator.php'

Which results in.

Running Tasks (1)


(1/1): Country Feed ... complete (3.8112509250641 sec) Done!

Is it possible to trigger the XMLimporter using pseudo-cron approach? i/e if I accessed the url of the named importer from pseudo process:

http://test.com/symphony/extension/xmlimporter/importers/run/testimport/?auth-token=123e45f6

Anyone done it this way? Cron isn't available to me on this server.

Any access to that URL by a logged in author will trigger the import.

What Pseudo process did you have in mind?

Pseudo Cron or poor mans cron.

You clicking import every 30 minutes?

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details