Forum

Posted by
Jerry van der Lek - September 2010
So there you are at work. Just looking at the latest and greatest you created with the best cms in the world :)

Suddenly you get a request 'write a script that fetches something and writes that to the cms. Oh and it should do that twice a day and must be free of charge'.

Now if you're good with Pike it wont be a problem, but i've seen a lot of web developpers who don't care about Pike and write everything in xslt/rxml.

Requirements:

- Wget
- Access to scheduling on linux / windows / whatever

The common way to write something to the cms in rxml is the <sb-edit-area> tag. To use it you must be authenticated to the cms.

You make an xml file and associate it to the propper xslt file and write your code. When you view the xml from the CE interface everything works out fine. But how do you schedule it?

One of the possible and easy answers is wget. You can download it from http://wget.addictivecode.org/FrequentlyAskedQuestions?action=show&redirect=Faq#download.

You should make two calls to your xml file with the extension ?__toolbar=1, this will force an authenticated session. The first call will fail, but we only use that so we can save the cookies send by the Roxen system. The next call uses those cookies to get an authenticated session so <sb-edit-area> will work:


wget --keep-session-cookies --save-cookies cookiest.txt http://username:password@server/path-to-xml.xml?__toolbar=1
wget -p  --load-cookies cookiest.txt http://username:password@server/path-to-xml.xml?__toolbar=1

Substitute the above with the correct username, password, server and path and save it as a script (.sh or .cmd). Now schedule it in cron or a windows scheduler and voila, you've build scheduling.
Posted by
Stefan Janson - September 2010
Another way for automated operations is to use sb-job.
See section 1.3 in pdf: https://extranet.roxen.com/support/docs/5.0/roxen/5.0/pdf/cms/cms-administrator/cms-administrator.pdf

Very little documentation, but maybe it can be useful.
Posted by
Jerry van der Lek - September 2010
yes sb-job is an option also. The thing was that I couldn't get an authenticated session with it, so I used wget.

This was on Roxen 4.5.111 by the way. We also have the sitebuilder-pull module to get some scheduling going, but you can't use <sb-edit-area> with it in an easy way.
Posted by
Peter Jnsson - September 2010
Nice and quick workaround with wget :) Of course one should be very careful with the username/psw setup in the AC since it is stored in plaintext in the cron-script. Not a biggie but it should be thought of.

Having a scheduled write to a a single file in the cvs:ed cms filesystem also makes the changelog grow quickly for that file. In some circumstances this might cause problems (e.g. try viewing the changelog for that file).
Another solution to the file-saving problem that works in most circumstances (as long as you dont edit these files manually in the cms) is to have your cronjob save the files to a normal disk with wget, curl etc. and mount a "Normal filesystem"-module into your cms site to make the file(s) available in roxen.
1
Search this thread: