Use initctl commands rather than service to control the ONOS service.
This supports a wider variety of OSes other than just Ubuntu.
Change-Id: Ib8505aa504f568ffdc556b20fb1d07a082d90229
diff --git a/tools/test/bin/onos-service b/tools/test/bin/onos-service
index d5fabe5..2e7c36e 100755
--- a/tools/test/bin/onos-service
+++ b/tools/test/bin/onos-service
@@ -31,14 +31,24 @@
exit 0
fi
-# Select the target
-if [ "${1}" = "--cell" ]; then
- nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2)
-else
- nodes=${1:-$OCI}
-fi
+case $2 in
+ start|stop|restart|status)
-# Execute the remote commands
-for node in $nodes; do
- ssh $ONOS_USER@${node} "sudo service onos ${2:-status}"
-done
+ # Select the target
+ if [ "${1}" = "--cell" ]; then
+ nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2)
+ else
+ nodes=${1:-$OCI}
+ fi
+
+ # Execute the remote commands
+ for node in $nodes; do
+ ssh $ONOS_USER@${node} "sudo ${2:-status} onos"
+ done
+ ;;
+ *)
+ echo "error: $2 is not a valid command"
+ echo ""
+ print_usage
+ ;;
+esac