Professional Web Applications Themes

Daemon configuration for Apache - PERL Beginners

Hi All, I want to write a daemon in Linux which would be calling my perl script to read some apache configuration when the System boots up. Here is what i am doing 1) When the system boots up I found in which run level System boots up and go to corresponding directory e.g. /etc/rc.d/rc3.d 2) I look for Sxxapache or Sxxhttp file to see if apache startup file is there Now my problem is one apache startup The configuration file Sxxapache or Sxxhttp has used some configuration file based on some shell script to invoke the configuration file as ...

  1. #1

    Default Daemon configuration for Apache

    Hi All,
    I want to write a daemon in Linux which would be calling my perl script to read some apache configuration when the System boots up. Here is what i am doing

    1) When the system boots up I found in which run level System boots up and go to corresponding directory e.g. /etc/rc.d/rc3.d
    2) I look for Sxxapache or Sxxhttp file to see if apache startup file is there

    Now my problem is one apache startup The configuration file Sxxapache or Sxxhttp has used some configuration file based on some shell script to invoke the configuration file as parameter and i need to know that file in my daemon to read that file e.g. httpd.conf file

    If you have any idea please help me to resolve this problem.

    Thanks,
    Amit.



    ---------------------------------
    Do you Yahoo!?
    Yahoo! Photos: High-quality 4x6 digital prints for 25
    Amrahsa Guest

  2. #2

    Default Re: Daemon configuration for Apache

    amrahsa wrote: 

    For Solaris the start-up controller is in /etc/init.d

    #! /usr/bin/perl

    use strict;
    use warnings;

    opendir TARGETDIR, "/etc/init.d" or die "$! during Directory Read";
    my allfiles = grep !/^\./, readdir TARGETDIR;
    closedir TARGETDIR;

    foreach my $file (allfiles) {
    last if $file =~ /apache|http/i;
    }

    open (ROFILE, "$file") or die "$! during File Read";

    # process file ...

    You can decide which CPAN module to mimic that being
    implemented as a daemon.

    HTH/Bill
    --
    _Sx_ http://youve-reached-the.endoftheinternet.org/
    __________________________________________________ _______________
    perl -MMIME::Base64 -e 'print
    decode_base64("SnVzdCBvbmUgbW9yZSBQb3N0Zml4IDIuMng gU25hcHNob3QgRmlsdGVyLCBwbGVhc2UK");'
    Wc Guest

  3. #3

    Default Re: Daemon configuration for Apache


    On Apr 24, 2004, at 2:46 AM, amrahsa wrote:
    [..] 
    [..]

    Let me see if I get your core problem here,

    you want to p out the httpd.conf
    but you want to find it 'dynamically'
    based upon what is in the /etc/rc.d/rc3.d section?

    you do understand that you could find the 'init script'
    for apache in

    /etc/rc.d/apache

    on SuSe distributions, while on Red Hat you would
    need to be looking for

    /etc/rc.d/init.d/httpd

    eg:
    disky: 62:] ls -li ./init.d/httpd ./rc3.d/S99httpd
    1055235 -rwxr-xr-x 1 root root 2245 Dec 10 02:05
    ../init.d/httpd
    97370 lrwxrwxrwx 1 root root 22 Aug 7 2002
    ../rc3.d/S99httpd -> /etc/rc.d/init.d/httpd
    disky: 63:]

    so clearly first off you can figure out which version
    of linux you are playing with by how they did their
    lay out - and there is little real 'useful' information
    that is in those init scripts to begin with. The
    line you would of course be interested in is

    [ -r /etc/sysconfig/apache ] && . /etc/sysconfig/apache

    the other line where it is 'including' anything
    is merely the shell library of rc_init functions
    that is common to all of the rc scripts.

    So what you really want to be resolving is whether
    you will find the httpd.conf in say

    /etc/httpd/conf/httpd.conf

    or not - since reasonable folks do not generally
    stuff shell variables into /etc/sysconfig/apache

    At which point there is the other odd question
    that comes to mind, why? What is it you are
    really trying to work out ? Why not talk to
    the httpd directly?


    ciao
    drieux

    ---

    Drieux Guest

  4. #4

    Default Re: Daemon configuration for Apache

    Hi,
    You understand the problem correctly. I wanted to
    get the path for httpd.conf file when the System boots
    up and my daemon will p the httpd.conf file to get
    the Server Address and the port number and some
    additional information from where your Server runs. I
    wanted to show this information to the user So that
    they can directly change their configuration rather
    than editing the file, I have reached till the steps
    where i can look for /etc/rc.d/rc3.d for httpd and
    apache files but seems for each vendor these files are
    written differently and i can not found the exact
    httpd.conf file. Please suggest what you say.

    Thanks,

    --- drieux <com> wrote: 
    > level System boots up 
    > /etc/rc.d/rc3.d 
    > apache startup file 
    > configuration file Sxxapache 
    > on some shell script 
    > i need to know that 
    > httpd.conf file 
    > this problem.
    > [..]
    >
    > Let me see if I get your core problem here,
    >
    > you want to p out the httpd.conf
    > but you want to find it 'dynamically'
    > based upon what is in the /etc/rc.d/rc3.d section?
    >
    > you do understand that you could find the 'init
    > script'
    > for apache in
    >
    > /etc/rc.d/apache
    >
    > on SuSe distributions, while on Red Hat you would
    > need to be looking for
    >
    > /etc/rc.d/init.d/httpd
    >
    > eg:
    > disky: 62:] ls -li ./init.d/httpd ./rc3.d/S99httpd
    > 1055235 -rwxr-xr-x 1 root root 2245
    > Dec 10 02:05
    > ./init.d/httpd
    > 97370 lrwxrwxrwx 1 root root 22
    > Aug 7 2002
    > ./rc3.d/S99httpd -> /etc/rc.d/init.d/httpd
    > disky: 63:]
    >
    > so clearly first off you can figure out which
    > version
    > of linux you are playing with by how they did their
    > lay out - and there is little real 'useful'
    > information
    > that is in those init scripts to begin with. The
    > line you would of course be interested in is
    >
    > [ -r /etc/sysconfig/apache ] && .
    > /etc/sysconfig/apache
    >
    > the other line where it is 'including' anything
    > is merely the shell library of rc_init functions
    > that is common to all of the rc scripts.
    >
    > So what you really want to be resolving is whether
    > you will find the httpd.conf in say
    >
    > /etc/httpd/conf/httpd.conf
    >
    > or not - since reasonable folks do not generally
    > stuff shell variables into /etc/sysconfig/apache
    >
    > At which point there is the other odd question
    > that comes to mind, why? What is it you are
    > really trying to work out ? Why not talk to
    > the httpd directly?
    >
    >
    > ciao
    > drieux
    >
    > ---
    >
    >
    > --
    > To unsubscribe, e-mail:
    > org
    > For additional commands, e-mail:
    > org
    > <http://learn.perl.org/>
    > <http://learn.perl.org/first-response>
    >
    >[/ref]




    __________________________________
    Do you Yahoo!?
    Yahoo! Photos: High-quality 4x6 digital prints for 25
    http://photos./ph/print_splash
    Amrahsa Guest

Similar Threads

  1. Need Paths For Configuration Apache 2.2 And ColdfusionMX7
    By spinaweb in forum Coldfusion Server Administration
    Replies: 1
    Last Post: February 27th, 02:08 AM
  2. Multiserver configuration with Apache 2
    By zu in forum Coldfusion Server Administration
    Replies: 1
    Last Post: May 30th, 03:26 PM
  3. OS X, Apache, PHP -- configuration problem
    By J.B. Moreno in forum PHP Development
    Replies: 2
    Last Post: January 2nd, 10:51 AM
  4. OT: Apache configuration for virtual directory?
    By Kenny-Z in forum PHP Development
    Replies: 2
    Last Post: September 20th, 04:43 AM
  5. Replies: 2
    Last Post: September 15th, 08:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139