diff options
author | Ashlee Young <ashlee@onosfw.com> | 2015-09-22 12:49:09 -0700 |
---|---|---|
committer | Ashlee Young <ashlee@onosfw.com> | 2015-09-22 12:49:09 -0700 |
commit | 81391595dca425ae58e2294898f09f11d9a32dbc (patch) | |
tree | f5d65c39a732150b2b29daa8de98a35d1236d3fb /framework/src/onos/tools/package/deb/prerm | |
parent | 0aa37e73dcb3a55b8d889b0c32ff74055551b1f3 (diff) |
bringing src to commit tag 65d551b50e782b0c1ea76c1a9ed1c5a801a5a7e4
Change-Id: Ib2da78962eaef856f418636c31b0f5c84286244f
Diffstat (limited to 'framework/src/onos/tools/package/deb/prerm')
-rwxr-xr-x | framework/src/onos/tools/package/deb/prerm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/framework/src/onos/tools/package/deb/prerm b/framework/src/onos/tools/package/deb/prerm new file mode 100755 index 00000000..2a1633da --- /dev/null +++ b/framework/src/onos/tools/package/deb/prerm @@ -0,0 +1,23 @@ +#!/bin/bash + +# Check if onos is running; if it is, stop onos +[ -z "$(status onos 2>/dev/null | grep start)" ] && echo "onos is not running." || ( + stop onos + + # Wait for onos to stop up to 5 seconds + for i in $(seq 1 5); do + [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && break + sleep 1 + done + [ -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.3/ +rm -rf /opt/onos/var/* +rm -rf /opt/onos/config +rm -rf /opt/onos/options +rm -rf /opt/onos/log + +#TODO consider removing the sdn user if we created it |