Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 34493 invoked from network); 8 Jun 2005 20:26:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 Jun 2005 20:26:46 -0000 Received: (qmail 15711 invoked by uid 500); 8 Jun 2005 20:26:32 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 15702 invoked by uid 500); 8 Jun 2005 20:26:32 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 15680 invoked by uid 99); 8 Jun 2005 20:26:32 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from jimsys.jaguNET.com (HELO jimsys.jagunet.com) (209.133.199.10) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 08 Jun 2005 13:26:30 -0700 Received: from [127.0.0.1] (localhost [127.0.0.1]) by jimsys.jagunet.com (Postfix) with ESMTP id A00215BA02F for ; Wed, 8 Jun 2005 16:26:10 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v730) In-Reply-To: References: <42A7098D.7010107@guardiandigital.com> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <09FE5E8A-6032-42FB-94F7-C5740AF6900A@jaguNET.com> Content-Transfer-Encoding: 7bit From: Jim Jagielski Date: Wed, 8 Jun 2005 16:26:09 -0400 To: users@httpd.apache.org X-Mailer: Apple Mail (2.730) X-Virus-Checked: Checked Subject: Re: [users@httpd] Script to upgrade httpd.conf 1.3.x to 2.x? X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Jun 8, 2005, at 4:04 PM, Joshua Slive wrote: > > Covalent had a script on their website at one point, but I can't find > it now. Perhaps someone still has a copy? > I'll see if I can get it re-added. In the meantime: #!/usr/bin/perl # ==================================================================== # The Covalent Technologies License, Version 1.1 # # Copyright (c) 2000-2001 Covalent Technologies. All rights # reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation andor other materials provided with the # distribution. # # 3. The end-user documentation included with the redistribution, # if any, must include the following acknowledgment: # "This product includes software developed by # Covalent Technologies (http://www.covalent.net/)." # Alternately, this acknowledgment may appear in the software itself, # if and wherever such third-party acknowledgments normally appear. # # 4. The names "Covalent" and "Covalent Technologies" must # not be used to endorse or promote products derived from this # software without prior written permission. For written # permission, please contact Covalent Technologies. # # 5. Products derived from this software may not be called "Covalent", # nor may "Covalent" appear in their name, without prior written # permission of Covalent Technologies. # # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL COVALENT TECHNOLOGIES OR # ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # ==================================================================== # # This software consists of voluntary contributions made by many # individuals on behalf of Covalent Technologies. For more # information on Covalent Technologies, please see # . # # # FILE: convconf.pl # # PURPOSE: # # Simple script to make an attempt at converting some of the obvious # syntatical changes between 1.3 and 2.0's configuration files. # This script will in most cases put the original line in a comment # prefixed with (1.3), and will put additional comments for some # new/changed directives prefixed with (2.0). # use strict; use warnings; use Getopt::Long; # The filename extention put on backup files my $bak = ".bak"; sub print_usage { print "usage: ".$0." [args...] [files...]\n". " Pass in a filename to convert from apache 1.3 to 2.0 syntax.\n". " A backup of the file is created \'filename".$bak."\' and\n". " then the given file is processed inline. If no filename is\n". " specified, input is taken from stdin, the converted config\n". " is produced on stdout, and no backup is made.\n". " -v = increase verbosity\n". " -h = print this help screen\n". " -- = stop parsing command arguments\n"; } my %deprecated_directives; # only print helpful comments once my $verbose = 0; my $help = 0; my $output; # if no args were specified, default to STDIN @ARGV = ('-') unless @ARGV; my $optsuccess = GetOptions('verbose!' => \$verbose, 'help' => \$help, 'bak' => \$bak); if (!$optsuccess || $help) { print_usage(); exit 1; } print STDERR "Verbosity at level $verbose.\n" if ($verbose > 0); while ($ARGV = shift @ARGV) { if ($ARGV eq "-") { print STDERR "Opening STDIN for reading, STDOUT for writing.\n" if ($verbose > 1); unless (open ARGV, $ARGV) { print STDERR "Can't open $ARGV: $!\n"; next; } print STDERR "Sending default output to STDOUT.\n" if ($verbose > 1); select STDOUT; } elsif (!stat($ARGV)) { warn "Skipping input file $ARGV: $!\n"; next; } elsif (stat("$ARGV$bak")) { warn "Backup file $ARGV$bak already exists for $ARGV. Skipping!\n"; next; } else { print STDERR "Renaming $ARGV to $ARGV$bak\n" if ($verbose > 1); unless (rename $ARGV, "$ARGV$bak") { print STDERR "Error saving backup file $ARGV$bak: $!\n"; next; } print STDERR "Opening $ARGV for output.\n" if ($verbose > 1); unless (open OUTPUT, ">$ARGV") { print STDERR "Unable to open original file: $!\n"; next; } print STDERR "Opening $ARGV$bak for input.\n" if ($verbose > 1); unless (open ARGV, $ARGV.$bak) { print STDERR "Can't open $ARGV: $!\n"; next } print STDERR "Sending default output to $ARGV.\n" if ($verbose > 1); select OUTPUT; } print STDERR "Done with input/output files.\n" if ($verbose > 1); # The main loop while () { if (/^[ \t]*#/i) { # Just transcribe any commented lines print; } elsif (/(.*)(ServerType|ClearModuleList|AddModule| MinSpareServers|MaxSpareServers)(.*)$/i) { # Take deprecated lines, print an error once, and then # print all the old lines under comments. if (!$deprecated_directives{$2}) { $deprecated_directives{$2} = 1; print "#\n"; print "# (Covalent 2.0): $2 has been deprecated.\n"; } print STDERR "Line $.: $2 has been deprecated.\n" if ($verbose > 0); print "# (1.3): ".$1.$2.$3."\n"; } elsif (/(.*)(MinSpareServers|MaxSpareServers|StartServers| MaxClients|MaxRequestsPerChild)(.*)/i) { # Remove old settings that are now handled by MPM settings. # Even if these don't change, it'll make it obvious to the # admins that there are other MPMs to play with. if (!$deprecated_directives{"MPM"}) { $deprecated_directives{"MPM"} = 1; if ($verbose > 0) { print STDERR "Line $.: Inserting new MPM directives. \n"; print STDERR < StartServers 5 MinSpareServers 5 MaxSpareServers 10 MaxClients 150 MaxRequestsPerChild 0 # threaded MPM # StartServers: initial number of server processes to start # MaxClients: maximum number of server processes allowed to start # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker threads which are kept spare # ThreadsPerChild: constant number of worker threads in each server process # MaxRequestsPerChild: maximum number of requests a server process serves StartServers 3 MaxClients 8 MinSpareThreads 5 MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 0 # worker MPM # StartServers: initial number of server processes to start # MaxClients: maximum number of server processes allowed to start # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker threads which are kept spare # ThreadsPerChild: constant number of worker threads in each server process # MaxRequestsPerChild: maximum number of requests a server process serves StartServers 3 MaxClients 8 MinSpareThreads 5 MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 0 # perchild MPM # NumServers: constant number of server processes # StartThreads: initial number of worker threads in each server process # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker threads which are kept spare # MaxThreadsPerChild: maximum number of worker threads in each server process # MaxRequestsPerChild: maximum number of connections per server process NumServers 5 StartThreads 5 MinSpareThreads 5 MaxSpareThreads 10 MaxThreadsPerChild 20 MaxRequestsPerChild 0 # Windows MPM # ThreadsPerChild: constant number of worker threads in the server process # MaxRequestsPerChild: maximum number of requests a server process serves ThreadsPerChild 250 MaxRequestsPerChild 0 # (Covalent 2.0): End of new MPM configuration directives. END } print "# (1.3): ".$1.$2.$3."\n"; print STDERR "Line $.: $2 has been deprecated.\n" if ($verbose > 0); } elsif (/(.*)(ScoreBoardFile)(.*)/i) { # The scoreboard should only be used in certain situations print "#\n"; print "# (Covalent 2.0): The $2 directive is only used on " ."operating systems\n" ."# with insufficient or unsupported " ."shared memory mechanisms.\n"; print STDERR "Line $.: Modifying $2 directive.\n" if ($verbose > 0); print STDERR "Note: [Covalent 2.0]: The $2 directive is only " ."used on operating\n" ." systems with insufficient or unsupported " ."shared memory mechanisms.\n" if ($verbose > 0); print "\n"; print "\n"; print $1.$2.$3."\n"; print "\n"; print "\n"; } elsif (/(.*)(LoadModule)([ \t]+[_a-z]+module[ \t]+)libexec\/(.*)/ i) { # If modules used to be in "libexec/", now they are in "modules/" if (!$deprecated_directives{$2}) { $deprecated_directives{$2} = 1; print "#\n"; print "# (Covalent 2.0): $2 has changed syntax. " ."Modules are\n"; print "# now by default placed in the ServerRoot/ modules\n"; print "# directory (instead of the ServerRoot/ libexec\n"; print "# diretcory in 1.3).\n"; print STDERR "Line $.: $2 has changed syntax, " ."attempting to convert.\n" if ($verbose > 0); } print $1.$2.$3."modules/".$4."\n"; } elsif (/(.*)(Port)(.*)/i) { # The Port directive has been replaced with the Listen directive. if (!$deprecated_directives{$2}) { $deprecated_directives{$2} = 1; print "#\n"; print "# (Covalent 2.0): $2 has been deprecated.\n"; print "# It has been replaced with the Listen directive.\n"; print STDERR "Line $.: $2 has been deprecated.\n" if ($verbose > 0); } print $1."Listen".$3."\n"; } else { # This is a good line, just copy it over. print; } } } --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See for more info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org " from the digest: users-digest-unsubscribe@httpd.apache.org For additional commands, e-mail: users-help@httpd.apache.org