2

Is there a tool which can control daemons/services in a cross-platform manner?

In programming there are different build tools that allow you to build software from source on different platforms; the tool will take care of detecting the capabilities of the particular machine and locate libraries, compilers, etc. CMake is an example.

There's a similar problem with controlling daemon's. Depending on the OS, if I want to start a daemon I might use

stop-start-daemon -S mydaemon

or perhaps call a script like

/etc/init.d/mydaemon start

or if systemctl is the tool of choice then

systemctl start mydaemon

And if I'm on Windows then I could use either net start myservice or sc start myservice.

Is there a tool, script, or other canonical method for handling this scenario? I don't need fine-grained control; just stop and start, but I'd like to be able to deploy my own software on multiple systems using the same script.

1
  • do you have the differences, maybe I can write something Commented Sep 24, 2014 at 5:12

2 Answers 2

3

To directly answer your question: no, there is not a cross platform way to start/stop/control daemons.

To indirectly answer your question: the typical way this is handled is by baking that kind of functionality into your program and installers (makefiles/build files/msi packages/zips whatever).

If I have a daemonized program that I am building (a program that is intended to run in the background or as a service), I build out the 'start/stop' scripts by hand (with some helpful copy/paste) and then zip up either the source or precompiled binary with the platform of choices control script that is then called the same way across each platform (i.e. myservice -start or myservice -stop, etc. etc.).

0

Needing this myself for my own software products, I decided to write it:

https://github.com/cubiclesoft/service-manager/

It isn't quite a flawless solution due to each platform needing its own precompiled binary. However, the interface is a lot more consistent than what we have at the moment. Service Manager is probably best used as a cross-platform service deployment tool, which meets your latter need for deploying your own software, rather than a general start/stop tool. That is, you write some code that you want to turn into a system service and make it easy and reliable to deploy on other machines regardless of OS.

However, it can also be used to start/stop other Service Manager enabled services. So as long as all the services you want to control are running under Service Manager, you can use a single tool to start and stop those services.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .