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 <jeff.d...@gmail.com>
*To:* users@httpd.apache.org; Tech Newbie <tec...@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 <tec...@yahoo.com
<mailto:tec...@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-unsubscr...@httpd.apache.org
<mailto:users-unsubscr...@httpd.apache.org>
" from the digest: users-digest-unsubscr...@httpd.apache.org
<mailto:users-digest-unsubscr...@httpd.apache.org>
For additional commands, e-mail: users-h...@httpd.apache.org
<mailto:users-h...@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-unsubscr...@httpd.apache.org
  "   from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to