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
diff --git a/tools/package/init/onos.service b/tools/package/init/onos.service
new file mode 100644
index 0000000..bc9b890
--- /dev/null
+++ b/tools/package/init/onos.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Open Network Operating System
+After=network-online.target
+After=local-fs.target
+
+[Service]
+Type=forking
+ExecStart=/etc/init.d/onos start
+ExecStop=/etc/init.d/onos stop
+Restart=always
+
+[Install]
+WantedBy=multi-user.target