9 Commits

Author SHA1 Message Date
Yuta HIGUCHI
4aa54e3d3a Minor fixes
- remove duplicate dependency
- fix typo in initd script

Change-Id: Ia94fcdc8c279da7c6b64923f89a9e75105bb862b
2017-08-15 10:22:05 -07:00
Bob Lantz
d22c991c6a Improvements for init.d, upstart, and systemd-based systems
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
2017-01-19 23:38:10 +00:00
Phil Huang
5c7279e041 Adding init-functions file for enviroment of LSB-compliant init scripts
In Ubuntu 14.04 and 16.04, the file of init-functions is placed in /lib/lsb/.

Change-Id: I101ee08a7b7795c41d9ec3eb8833bee0e2f38e1c
2016-07-07 17:39:20 +00:00
Bob Lantz
7c751b51e7 Cross-platform changes to onos.initd
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
2016-04-25 15:24:46 +00:00
Jonathan Hart
e01652f745 Add init info to init.d script so it can be configured to run at startup.
Change-Id: Ie8b36ad123febe4be06837f3eb4a2ed28df3b31b
2016-03-29 21:36:34 +00:00
Bob Lantz
641d54540c Fix upstart failing because of background onos-service (ONOS-4117)
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
2016-03-08 01:32:47 +00:00
Jonathan Hart
1c401ee6b8 Fix issue with debug option not being picked up by init.d script
Change-Id: I47499ae253484d34d677c339b34fec6e53addcbe
2016-03-01 20:03:48 +00:00
Bob Lantz
3ec585d7dd Clarify config parameters/environment variables
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
2016-02-29 18:47:58 +00:00
Jonathan Hart
f51950db6e Proposal for replacing Upstart with init.d script.
Change-Id: I22ad1faac713bb50f0b7ad3dde132363a6588723
2016-02-26 05:37:13 +00:00