You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Tech Newbie <te...@yahoo.com> on 2011/09/19 20:07:24 UTC

[users@httpd] Starting/Stopping Apache via an API

I am aware of the way to start/stop Apache via apachectl, both locally and remotely via SSH.


Is there some generic unix API, perhaps related to /sbin/service, that I can remotely programmatically start Apache without exec'ing apachectl directly?

I'm thinking since Apache is already configured in /etc/init.d, is there a unix API that my program can interface with, that say something like:

  // start Apache via some API

  service.start("Apache"); 

Without my program actually exec'ing apachectl directly?

Re: [users@httpd] Starting/Stopping Apache via an API

Posted by Rob Stone <ro...@mira.net>.
On 22/09/11 07:34, Tech Newbie wrote:
> The intent is to create (or find) a generic service management call that
> will start/stop/getStatus for any given service.
> For example:
>
> startService(String serviceName), stopService(String serviceName)where
> serviceName maybe "Apache2", "JBoss", etc.
>
> The routines will programmatically start/stop the specified service,
> preferably via an API instead of exec'ing a shell script.
> That's why I was wondering if /sbin/service has a companion API.
>
> ------------------------------------------------------------------------
> *From:* Jeff Dyke <je...@gmail.com>
> *To:* users@httpd.apache.org; Tech Newbie <te...@yahoo.com>
> *Sent:* Monday, September 19, 2011 1:38 PM
> *Subject:* Re: [users@httpd] Starting/Stopping Apache via an API
>
> On Mon, Sep 19, 2011 at 2:07 PM, Tech Newbie <technb@yahoo.com
> <ma...@yahoo.com>> wrote:
>  > I am aware of the way to start/stop Apache via apachectl, both
> locally and
>  > remotely via SSH.
>  >
>  > Is there some generic unix API, perhaps related to /sbin/service,
> that I can
>  > remotely programmatically start Apache without exec'ing apachectl
> directly?
>  > I'm thinking since Apache is already configured in /etc/init.d, is
> there a
>  > unix API that my program can interface with, that say something like:
>  > // start Apache via some API
>  > service.start("Apache");
>  > Without my program actually exec'ing apachectl directly?
>
> All apachectl is doing is wrapping around httpd, so you want a wrapper
> for the wrapper? What is the ultimate intent. There are different
> interfaces into services (/etc/init.d) on different versions of linux,
> Ubuntu is different on newer versions then it was on old ones (service
> apache2 start vs /etc/init.d/apache2 start), though they both work.
>
> Since i always compile apache2, i've found it easiest to allow work
> with apachectl directly, that way the same commands work regards of
> unix/linux variant.
>  >
>  >
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> <ma...@httpd.apache.org>
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> <ma...@httpd.apache.org>
> For additional commands, e-mail: users-help@httpd.apache.org
> <ma...@httpd.apache.org>
>
>
>

Read the man page for anacron. It might do the trick.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> 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


Re: [users@httpd] Starting/Stopping Apache via an API

Posted by Tech Newbie <te...@yahoo.com>.
The intent is to create (or find) a generic service management call that will start/stop/getStatus for any given service.
For example:

startService(String serviceName), stopService(String serviceName)where serviceName maybe "Apache2", "JBoss", etc.


The routines will programmatically start/stop the specified service, preferably via an API instead of exec'ing a shell script.
That's why I was wondering if  /sbin/service has a companion API.



________________________________
From: Jeff Dyke <je...@gmail.com>
To: users@httpd.apache.org; Tech Newbie <te...@yahoo.com>
Sent: Monday, September 19, 2011 1:38 PM
Subject: Re: [users@httpd] Starting/Stopping Apache via an API

On Mon, Sep 19, 2011 at 2:07 PM, Tech Newbie <te...@yahoo.com> wrote:
> I am aware of the way to start/stop Apache via apachectl, both locally and
> remotely via SSH.
>
> Is there some generic unix API, perhaps related to /sbin/service, that I can
> remotely programmatically start Apache without exec'ing apachectl directly?
> I'm thinking since Apache is already configured in /etc/init.d, is there a
> unix API that my program can interface with, that say something like:
>   // start Apache via some API
>   service.start("Apache");
> Without my program actually exec'ing apachectl directly?

All apachectl is doing is wrapping around httpd, so you want a wrapper
for the wrapper?  What is the ultimate intent.  There are different
interfaces into services (/etc/init.d) on different versions of linux,
Ubuntu is different on newer versions then it was on old ones (service
apache2 start vs /etc/init.d/apache2 start), though they both work.

Since i always compile apache2, i've found it easiest to allow work
with apachectl directly, that way the same commands work regards of
unix/linux variant.
>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> 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

Re: [users@httpd] Starting/Stopping Apache via an API

Posted by Jeff Dyke <je...@gmail.com>.
On Mon, Sep 19, 2011 at 2:07 PM, Tech Newbie <te...@yahoo.com> wrote:
> I am aware of the way to start/stop Apache via apachectl, both locally and
> remotely via SSH.
>
> Is there some generic unix API, perhaps related to /sbin/service, that I can
> remotely programmatically start Apache without exec'ing apachectl directly?
> I'm thinking since Apache is already configured in /etc/init.d, is there a
> unix API that my program can interface with, that say something like:
>   // start Apache via some API
>   service.start("Apache");
> Without my program actually exec'ing apachectl directly?

All apachectl is doing is wrapping around httpd, so you want a wrapper
for the wrapper?  What is the ultimate intent.  There are different
interfaces into services (/etc/init.d) on different versions of linux,
Ubuntu is different on newer versions then it was on old ones (service
apache2 start vs /etc/init.d/apache2 start), though they both work.

Since i always compile apache2, i've found it easiest to allow work
with apachectl directly, that way the same commands work regards of
unix/linux variant.
>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> 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