#!/bin/ksh

#Motadata Agent service file for startup and stop in AIX

case "$1" in
     "start")
          cd /motadata/motadata/ 
          ./motadata-manager.sh
          ;;

     "stop")
          kill $(ps -ef | grep -v grep | grep -i motadata-manager | awk '{print $2}')
          rm -rf /tmp/_MEI* /tmp/vertx-cache* /tmp/*-libsnappyjava.a
          ;;

     "status")
          ps -ef | grep -v grep | grep -i "com.mindarray"
          ps -ef | grep -v grep | grep -i "motadata-metric-agent" 
          ps -ef | grep -v grep | grep -i "motadata-log-agent"
          ;;

     * )
        echo "Usage: $0 (start | stop | status)"
        exit 1
 
esac
exit 0
