tags:

views:

25

answers:

1

I'm doing a distribution of tomcat for a many servers and in each of these servers the realm is going to be different. I would like to have a file /etc/tomcat/realm.xml containing the realm for that installation and have the file /var/lib/tomcat/conf/server.xml import it directly. I've tried with Xinclude without luck and I'm about to resort to sed to the import when running /etc/init.d/tomcat. Is there a better way to do this?

A: 

I'm not familiar with tomcat, but will it recognize/handle a system entity?

I'm not sure what the root element of /var/lib/tomcat/conf/server.xml is, so I'll just use server in my example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server [
<!ENTITY realm SYSTEM "/etc/tomcat/realm.xml">
]>
<server>
&realm;
</server>

Would something like that work?

DevNull
I'm going to give that a try and post back if it worked.
rmarimon
This works perfectly but doesn't seem as robust as I would like. I ended up using something like the result of this question http://stackoverflow.com/questions/2699666/replace-delimited-block-of-text-in-file-with-the-contents-of-another-file
rmarimon
Glad you got it working. Thanks for posting the link to the other question.
DevNull