1. Change ownership of /onos/apps
onos-service needs write access to onos/apps/foo in order to activate
an app. This also means that ONOS itself could also activate/deactivate,
modify, or reinstall apps, which seems a bit dodgy but is probably
intended.
2. Fix sudo command line
The -b option was in the wrong place, breaking sudo on systems where
we use sudo to start onos (e.g. older debian or centos.)
3. Redirect stderr of 'type daemon' command
We want to detect whether the 'daemon' function/script is available
in init.d enviroments that support it, and we do so using the type
command. Previously we didn't redirect stderr, so this resulted
in a confusing error message being sent to stderr of whoever is
invoking the script.
4. onos.conf has changed to be more consistent with onos.initd
Previously onos.conf ignored $ONOS_GROUP and had a slightly different
structure.
5. onos.service has been added for systemd-based systems
This initial version of onos.service calls /etc/init.d/onos to start
and stop ONOS. In the future we may be able to call onos-service
directly, but we will need to make sure that permissions are set up
correctly so that onos-service can activate apps and so that ONOS
itself can write its log files.
6. A README has been added
7. Update the onos-install and onos-uninstall scripts
Related Jira issue: ONOS-5550
Change-Id: Ie72775f1d0a4082af9c5ea9b13999c427c15ffe0
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