sandy1028 has asked for the wisdom of the Perl Monks concerning the following question:

Can anyone help me how to stop apache server through the script I have to execute `servicectl stop` from the perl code.

Replies are listed 'Best First'.
Re: Stop apache server
by Illuminatus (Curate) on Mar 12, 2009 at 12:23 UTC
    I am not sure I understand what you are really asking. If all you want to do is execute 'servicectl stop' from within perl, you can just:
    my $result=`servicectl stop`;
    $result will contain any output it produces
Re: Stop apache server
by irah (Pilgrim) on Mar 12, 2009 at 12:35 UTC

    If you are using Linux platform, use the following suggestion.

    You can generate a signal TERM to the parent process using kill function in Perl. If you want to restart the process, send a HUP signal.

    Further more information please gone through here.

Re: Stop apache server
by slacker (Friar) on Mar 12, 2009 at 14:51 UTC
    Since Apache is available for Windows and Linux, which OS are you running?
    If Linux is your current OS, what distribution?
    If you're running Redhat, a simple system command using
    service httpd stop
    should be more than sufficient.
    Unfortunately there are a lot of questions that must be answered before we can offer useful guidance.
Re: Stop apache server
by n3toy (Hermit) on Mar 12, 2009 at 15:20 UTC
    I use apachectl on my Linux box, not servicectl to start/stop/restart the service. I am not familiar with the servicectl command, but I don't profess to know much.