Brian O'Connor | 8a0c20e | 2015-09-16 22:54:24 -0700 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Check if onos is running; if it is, stop onos |
| 4 | [ -z "$(status onos 2>/dev/null | grep start)" ] && echo "onos is not running." || ( |
| 5 | stop onos |
| 6 | |
| 7 | # Wait for onos to stop up to 5 seconds |
| 8 | for i in $(seq 1 5); do |
| 9 | [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && break |
| 10 | sleep 1 |
| 11 | done |
| 12 | [ -z "$(ps -ef | grep karaf.jar | grep -v grep)" ] && echo 'Stopped onos service' || echo 'Failed to stop onos' |
| 13 | ps -ef | grep karaf.jar | grep -v grep |
| 14 | ) |
| 15 | |
| 16 | # Clean up onos runtime directories |
| 17 | # TODO don't hardcode karaf version |
| 18 | rm -rf /opt/onos/apache-karaf-3.0.3/ |
| 19 | rm -rf /opt/onos/var/* |
| 20 | rm -rf /opt/onos/config |
| 21 | rm -rf /opt/onos/options |
| 22 | rm -rf /opt/onos/log |
| 23 | |
| 24 | #TODO consider removing the sdn user if we created it |