We now can use start-stop-daemon (debian), daemon()
shell function (centos), or sudo (others) to start
onos-service.
It should be backward compatible on systemd systems.
Tested on Ubuntu 14 and CentOS 6. Should also work on
Ubuntu 15/16, CentOS 7, Debian, and Fedora.
(Note that we should test this against various OSes,
preferably automatically rather than manually!)
Addresses at least part of ONOS-2907
Change-Id: I4ded98baf02321a5a9db37fdff19e1ce4a3d23d2
1. Invoke karaf script in all cases (upstart, initd/systemd)
This means that onos-service now blocks, which means we need to
change onos.initd to run it in the background. Otherwise, we could
use karaf/bin/start
This should fix ONOS-4117
2. Use service onos {start/status/etc.} for upstart/init/systemd
onos-install should not invoke the new init.d script directly;
instead it should use service onos {cmd, which should work if
service is available on upstart, init.d, and systemd-based
distributions.
This should fix ONOS-4124
3. In onos.initd, check if ONOS is running.
This makes it easier to see what is going on, and it also avoids
attempting to start ONOS if it's already running.
Change-Id: I0152fd7fdcb079b25531442315d0bd69e6c7653d
As mentioned in the comments, ideally this script can be used as
the basis for an ONOS service in a variety of environments. Out of
the box it should work on Linux with either init.d or with systemd's
init.d compatibility. It can also be called by an upstart configuration
or a systemd configuration.
In the future we should probably remove start-stop-daemon, since that
seems to be a linux-ism. Then we could use this script on BSD, OS X,
etc..
Change-Id: I9c701c95991448fa7ddf0d84d379a4cac56cfc5f