#!/bin/bash

ProcList="restagent crontask sshsvc"

BinDir=/usr/local/omc/bin

case "$1" in
        start)
            for procName in $ProcList;do
                echo  "Starting $procName process  ..."
                systemctl start $procName
                sleep 1
            done
        ;;
        status)
            for procName in $ProcList;do
                systemctl status $procName
            done
        ;;
        stop)
            for procName in $ProcList;do
               echo  "Stoping $procName process  ..."
               systemctl stop $procName
            done
        ;;
        restart)
                $0 stop
                sleep 1
                $0 start
        ;;
        version)
            for procName in $ProcList;do
                $BinDir/$procName -v
            done
        ;;
        *)
                echo "OMC"
                echo "Usage: $0 start|status|stop|restart|version"
        ;;
esac            
                                                                                                                                                                                                                                                                                                        
