#!/bin/sh
# flexa-app start-up script.
APP_NAME="flexa-agent"
APP_PID_FILE="/var/run/${APP_NAME}.pid"


start() {
	echo "${APP_NAME}: Starting the ${APP_NAME} application..."
	$APP_NAME &
	echo "${APP_NAME}: Starting the ${APP_NAME} application...DONE"
}

stop() {

	echo "${APP_NAME}: Stopping the ${APP_NAME} application..."	
	kill ${APP_PID_FILE}
	rm -f ${APP_PID_FILE}
	echo "${APP_NAME}: Stopping the ${APP_NAME} application...DONE"
}

restart() {
	stop
	start
}


case "$1" in                                                                   
        start)                                                                  
                start                                                           
                ;;                                                             
        stop)                                                                   
                stop                                                            
                ;;                                                             
        restart|reload)                                                         
                restart                                                         
                ;;                                                             
        *)                                                                      
                echo "Usage: $0 {start|stop|restart}"                           
                exit 1                                                         
esac         