| # Check if onos is running; if it is, stop onos |
| [ -z "$(status onos 2>/dev/null | grep start)" ] && echo "onos is not running." || ( |
| # Wait for onos to stop up to 5 seconds |
| [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && break |
| [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && echo 'Stopped onos service' || echo 'Failed to stop onos' |
| # Clean up onos runtime directories |
| # TODO don't hardcode karaf version |
| rm -rf /opt/onos/apache-karaf-3.0.8/ |
| #TODO consider removing the sdn user if we created it |