Do something like this :
int maxConnections = 33;
String httpd = "/usr/local/apache/conf/httpd.conf";
String tmphttpd = "/usr/local/apache/conf/httpd.new";
String oldhttpd = "/usr/local/apache/conf/httpd.old";
BufferedReader in = new BufferedReader(new FileReader(new File(httpd)));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new
FileOutputStream(, true)));
while ((str=in.readLine()) !=null) {
if (str.startsWith("maxconnections=")) {
out.write("maxconnections="+newMaxConnections);
}else{
out.write(str);
}
}
out.close();
in.close();
File h = new File(httpd);
File t = new File(tmphttpd);
File o = new File(oldhttpd);
h.renameTo(o);
t.renameTo(h);
//EOF
Not the most beautifull code and if you get rid of all the typos I made, you
could use this (I'll leave the main to you...)
Mvgr,
Martin
> -----Original Message-----
> From: Venkatesh Sangam [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 23, 2001 3:20 AM
> To: [EMAIL PROTECTED]
> Subject: RE: Help Needed
>
>
> I will b changing the value of max connections before the apache
> server is
> started ..
> is there any other way (other than fileoutputstream) to modify the max
> connections ??
>
> thanks
> Venkatesh
>
>
> From: Warren Crossing <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: RE: Help Needed
> Date: Wed, 23 May 2001 10:30:03 +1000
>
> Maybe you can write to the file wil java.io.FileOutputStream, not nice to
> code really. & would apache even listen to a runtime modification of this
> value?????
> Probably just best to pick a value and run with it.
>
>
> -----Original Message-----
> From: Venkatesh Sangam [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 23 May 2001 9:42 AM
> To: [EMAIL PROTECTED]
> Subject: RE: Help Needed
>
>
> Hi,
>
> can I write a Java program to change the max connections ??
> can a Java program access the httpd.conf file ??
>
> Moreover there is an attribute called maxconnections in
> conf/tomcat.properties
>
> what is the difference between the one specified in httpd/conf/httpd.conf
> and the one specified in conf/tomcat.properties
>
> Please tell me if this attribute could be changed from a Java Program ..
> thanks
> Venkatesh
>
>
> From: Nael Mohammad <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: RE: Help Needed
> Date: Tue, 22 May 2001 14:05:39 -0700
>
> Go to the httpd.conf file and look for MAX Connections and change the
> default to whatever you want it to be.
>
> /etc/httpd/conf/httpd.conf
>
>
> -----Original Message-----
> From: Venkatesh Sangam [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 22, 2001 11:01 AM
> To: [EMAIL PROTECTED]
> Subject: Help Needed
>
>
> Hi,
>
> can anyone please tell me how to change maxconnections for Apache..
> please help
> thanks
> Venkatesh
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>