Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

2shortplanks (968)

2shortplanks
  (email not shown publicly)
http://2shortplanks.com/
AOL IM: trelane2sp (Add Buddy, Send Message)
Yahoo! ID: trelane2sp (Add User, Send Message)

Mark Fowler has never been the same since he was elected leader of the London Perl Mongers. The strain manifests itself mainly in releasing various [cpan.org] modules [cpan.org] to CPAN, giving talks [2shortplanks.com], and use of the Trelane nick on #london.pm for endless procrastination. Doctors are still seeking a cure.
Tuesday August 10, 2004
04:53 AM

Messing around with httpd.conf

[ #20339 ]
So, I decided last night to have a complete reorg of my httpd.conf. I broke each of the virtual hosts up into their own files, so I have /virtual/twoshortplanks.com/www/conf/httpd.conf for example, and then use the Include directive to bring them into the main file. This means that all the stuff for each virtual host is truly under /virtual now and makes things like backing up a lot clearer.

However, I want to go a little further. I'm fed up taking down and bringing up the main servers every time I want to change a config change (which is quite often when I'm playing around with AxKit for example.) So I want to be able to run each virtual host standalone on a high port as well as run it as part of the main server. To this end I've split the remaining main httpd.conf into a common.conf and all.conf. And I've implemented a standalone.conf for each virtual host that uses the common.conf and starts the high-port server.

This is all fine and dandy, but what I want is an apachectl for each of these development servers. Which leads me to a problem. They're written in bash. Has anyone got any idea how to referrer to a file relative to the bash script itself (i.e. what Perl's FindBin module does?.) I really don't want to have to have a apachectl file that's hardcoded for each and every server.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • It's more or less similiar to perl:
    mydir=`dirname $0`

    Of course, this forks an external command, so you might prefer the builtin, but slightly uglier syntax

    mydir=${0%/*}

    -Dom

  • apachectl is a tiny script. I use a perl replacement that I stole from Krang [sf.net].