blob: 7a8b9a5fc1895312328a1fce8253470f9f890fdc [file] [log] [blame]
tom5c255702014-09-18 06:57:39 -07001#!/bin/bash
Pavlin Radoslavov91413792014-10-15 11:00:32 -07002# -----------------------------------------------------------------------------
tom1a2908c2014-09-23 16:37:39 -07003# Remotely stops & uninstalls ONOS on the specified node.
Pavlin Radoslavov91413792014-10-15 11:00:32 -07004# -----------------------------------------------------------------------------
tom5c255702014-09-18 06:57:39 -07005
6[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7. $ONOS_ROOT/tools/build/envDefaults
8
9remote=$ONOS_USER@${1:-$OCI}
10
Pavlin Radoslavov20bc6ae2014-12-03 05:35:04 +000011ssh $remote "
Jonathan Hartd0a97bc2015-07-21 10:31:44 -070012 sudo stop onos 1>/dev/null 2>/dev/null
Brian O'Connorc045c4a2015-09-17 16:09:44 -070013
14 # Wait for onos to stop up to 5 seconds
15 for i in \$(seq 1 5); do
16 [ -z \"\$(ps -ef | grep karaf.jar | grep -v grep)\" ] && break
17 sleep 1
18 done
19 [ -z \"\$(ps -ef | grep karaf.jar | grep -v grep)\" ] || echo 'ONOS failed to stop.'
20
21 # Remove onos directory and init file
tom5c255702014-09-18 06:57:39 -070022 sudo rm -fr $ONOS_INSTALL_DIR
Brian O'Connorc045c4a2015-09-17 16:09:44 -070023 [ -f /etc/init/onos.conf ] && sudo rm /etc/init/onos.conf
tom5c255702014-09-18 06:57:39 -070024"