Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Stop apache server

by sandy1028 (Sexton)
on Mar 12, 2009 at 11:54 UTC ( [id://750133]=perlquestion: print w/replies, xml ) Need Help??

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://750133]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-03-28 23:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found