unixar
Posts: 1
Joined: May 2007
Reputation: 0
|
Tomcat Hosting
Is it possible to add tomcat support? Like using something like this script written in per: usage script.pl host home user group alias1 alias2 alias3
"I use this script to make my sites, I wonder if it can be integrated into ispc"
#!/usr/bin/perl -w
$tomcatdir = "/etc/tomcat5";
($host, $home, $vuid, $vguid, @aliases) = @ARGV;
print "Adding virtual host $host\n";
foreach $alias (@aliases) {
print "Adding alias $alias for $host\n";
}
print "Editing $tomcatdir/server.xml\n";
open (FILE, "$tomcatdir/server.xml") || die "Can't open server.xml";
open (NEWFILE, ">$tomcatdir/new-server.xml") || die "Can't open new-server.xml";
while ($buf = <FILE>) {
if ($buf =~ /VIRTUAL HOST INJECTION POINT/) {
print "Injecting $host\n";
print NEWFILE <<endvhost;
<Host name="$host" debug="0" appBase="$home"
unpackWARs="true" autoDeploy="true">
<Context path="" docBase=""/>
<Logger className="org.apache.catalina.logger.FileLogger"
directory="$home/logs" prefix="$host\-tomcat." suffix=".log" timestamp="true"/>
endvhost
;
foreach $alias (@aliases) {
print NEWFILE "<Alias>$alias</Alias>\n";
}
print NEWFILE "</Host>\n\n";
}
print NEWFILE $buf;
}
close NEWFILE;
close FILE;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime(time);
$now = ($year + 1900) . ($mon + 1) .
`mv $tomcatdir/server.xml $tomcatdir/server-\`date -Iseconds\`.xml`;
`mv $tomcatdir/new-server.xml $tomcatdir/server.xml`;
print "Making blank directory\n";
`mkdir $home/WEB-INF`;
`mkdir $home/WEB-INF/classes`;
`mkdir $home/WEB-INF/lib`;
`chown -R $vuid:$vgid $home/WEB-INF';
open (FILE, ">$home/WEB-INF/web.xml") || die "Can't open web.xml";
print FILE <<webapp;
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app>
</web-app>
webapp
;
close FILE;
sleep(5);
print "Reloading Tomcat\n";
`/etc/init.d/tomcat5 force-reload`;
|
|
05-19-2007 04:52 PM |
|