Forum OpenACS Q&A: Using the API for shell scripts

Request notifications

Hello, all!

This is my first post to the list.
Thanks to the builders of OpenACS.
It is a great piece of software!

My organization is testing OpenACS (with dotLrn)
and I have to load many users and courses from one
external DB (more than 10000 users). Is there any way
to make a shell script from command line (not Web)
to insert the users and courses in OpenACS?
I am reading the API and doing some testing without any

If that is possible, please, send me one example

Best regards,

Posted by Lars Pind on
Hi Jose

Welcome to the community!

Have you looked at the batch synchronization?

If you have the possibility of fitting the users into a big XML document following the IMS Enterprise 1.1 specification for user information, we can load it into .LRN automatically.

The documentation is still a bit short of perfect:*checkout*/openacs-4/packages/acs-authentication/www/doc/ims-sync-driver-design.html

Visit /acs-admin/auth/ on your server to work it.

If you need anything explained, just post here.


Posted by Jose Agustin Lopez Bueno on
Hello, Lars!

Thanks for the reply.

That is a nice tool!
But I need some thing more flexible, for
calling from command line (linux bash).

I am looking the code for call tcl procs that
I need but I have found that several tcl used code is
embebed in aolserver (like nsv_array structure)
and I do not know how could I use that
from my program (it is programed in C).
Any pointer??

All the way, I think of OpenACS would need full
independence from aolserver code. In that way we
could build tools for administrate since command


Posted by Andrew Piskorski on
Jose, you are writing a stand-alone program in C, which you call from the command line? In that case, why would you ever need nsv? Nsv is for sharing data between threads in AOLserver. What does your command line C program do? Is this still for the "load many courses and users into OpenACS from an external database" problem that you opened this thread with? If so I don't see why you'd be doing any C coding at all for that.

I think the following is not useful for Jose's application, but just in case:

If on the other hand you're writing an AOLserver module in C, you may have noticed that AOLserver provides no C API to nsv, only a Tcl API. However, it is fortunately not too difficult to add an efficient C NSV API. I have done so and use it myself, although I never packaged it up for release. (Which means if someone actually needs it, let me know.)

If you are writing a non-AOLserver multi-threaded program and miss the AOLserver Nsv API, you are in luck, just use the Tcl Threads Extension with tclsh. It's tsv api is just like nsv only better. Last time I looked tsv also has only a Tcl API no C; I never tried to add a C API to it but presumably it should also be feasible.

Posted by John Sequeira on

I've been working on a project to do this,  and running arbitrary API code works pretty well.  This is an old version of the code,  but should do what you want.

If you have trouble getting it working,  I'll try to package up something more current.




Posted by Caroline Meeks on
Hi Agustin,

I am in the process of transfering a slightly smaller amount of data from a legacy system to a dotLRN1.0 postgres system. I am working from a excel export of the data so I am useing CSV. I created almost 5000 users from a CSV and the web interface in a couple hours. The trick for me was running Jeff's object__new performance improvements.

For Sloan we transfered data from a legacy ACES database on the same box Tracy wrote scripts that connected to both databases, extracting the data from the old database then running the tcl APIs to import the data into dotLRN. AISEC expanded and refined these scripts.

If you want to connect up to two running databases see this thread:

If you want to extract your old data as CSV and upload it contact me, I'm doing that this week.