Added some more features to the tomcat service

svn path=/nixos/trunk/; revision=12284
This commit is contained in:
Sander van der Burg 2008-07-06 19:55:34 +00:00
parent 82ddadc27c
commit 6a2600c0a2
2 changed files with 21 additions and 1 deletions

View File

@ -1459,6 +1459,16 @@
default = "";
description = "Location where webapplications are stored. Leave empty to use the baseDir.";
};
javaOpts = mkOption {
default = "";
description = "Parameters to pass to the Java Virtual Machine which spawns Apache Tomcat";
};
sharedLibFrom = mkOption {
default = "";
description ="Location where shared libraries are stored. Leave empty to use the baseDir.";
};
};
disnix = {

View File

@ -33,6 +33,7 @@ in
if ! test -d ${cfg.baseDir}
then
mkdir -p ${cfg.baseDir}/webapps
mkdir -p ${cfg.baseDir}/shared
cp -av ${pkgs.tomcat6}/{conf,temp,logs} ${cfg.baseDir}
fi
@ -61,9 +62,18 @@ in
do
chmod -v 644 $i
done
# Deploy all shared libraries
if ! test "${cfg.sharedLibFrom}" = ""
then
rm -f ${cfg.baseDir}/shared/lib
ln -s ${cfg.sharedLibFrom} ${cfg.baseDir}/shared/lib
fi
end script
respawn ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c 'CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${pkgs.jdk} ${pkgs.tomcat6}/bin/startup.sh; sleep 1d'
respawn ${pkgs.su}/bin/su -s ${pkgs.bash}/bin/sh ${cfg.user} -c 'CATALINA_BASE=${cfg.baseDir} JAVA_HOME=${pkgs.jdk} JAVA_OPTS="${cfg.javaOpts}" ${pkgs.tomcat6}/bin/startup.sh; sleep 1d'
stop script
echo "Stopping tomcat..."