#!/bin/bash # Generic Init script if we can't find what kind of Linux we're on agent_dir=OGP_AGENT_DIR agent_user=OGP_USER # Start function. start() { echo "Starting GSP Agent..." cd $agent_dir su -c "screen -d -m -t gsp_agent -c ogp_screenrc -S gsp_agent ./gsp_agent_run -pidfile gsp_agent_run.pid" $agent_user &> $agent_dir/gsp_agent.svc & echo } # Stop function. stop() { echo "Stopping GSP Agent..." kill `cat $agent_dir/gsp_agent_run.pid` } restart() { stop start } case $1 in start) start ;; stop) stop ;; restart) restart ;; *) echo "Usage: gsp_agent {start|stop|restart}" exit 1 ;; esac exit 0;