Jonathan Hart
Committed by Gerrit Code Review

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
...@@ -31,14 +31,24 @@ if [ "${1}" = "-h" -o "${1}" = "--help" ]; then ...@@ -31,14 +31,24 @@ if [ "${1}" = "-h" -o "${1}" = "--help" ]; then
31 exit 0 31 exit 0
32 fi 32 fi
33 33
34 -# Select the target 34 +case $2 in
35 -if [ "${1}" = "--cell" ]; then 35 + start|stop|restart|status)
36 +
37 + # Select the target
38 + if [ "${1}" = "--cell" ]; then
36 nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2) 39 nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2)
37 -else 40 + else
38 nodes=${1:-$OCI} 41 nodes=${1:-$OCI}
39 -fi 42 + fi
40 43
41 -# Execute the remote commands 44 + # Execute the remote commands
42 -for node in $nodes; do 45 + for node in $nodes; do
43 - ssh $ONOS_USER@${node} "sudo service onos ${2:-status}" 46 + ssh $ONOS_USER@${node} "sudo ${2:-status} onos"
44 -done 47 + done
48 + ;;
49 + *)
50 + echo "error: $2 is not a valid command"
51 + echo ""
52 + print_usage
53 + ;;
54 +esac
......