#!/bin/bash

ProcList="restagent sshsvc"
ProcListDesc="restagent sshsvc"

BinDir=/usr/local/omc/bin

case "$1" in
        start)
            for procName in $ProcListDesc;do
                echo -n "Starting $procName process  ... "
                systemctl start $procName
                if [ $? = 0 ]; then
                    echo "done" 
                fi 
                sleep 1
            done
        ;;
        status)
            for procName in $ProcList;do
                systemctl status $procName
            done
        ;;
        stop)
            for procName in $ProcList;do
                echo -n "Stopping $procName process  ... "
                systemctl stop $procName
                if [ $? = 0 ]; then
                    echo "done" 
                fi            
            done
        ;;
        restart)
                $0 stop
                sleep 1
                $0 start
        ;;
        version)
            for procName in $ProcList;do
                $BinDir/$procName --version
            done
        ;;
        *)
                echo "OMC service"
                echo "Usage: $0 start|status|stop|restart|version"
        ;;
esac     
