????

Your IP : 216.73.216.152


Current Path : /usr/local/lp/etc/sonarpush/template/
Upload File :
Current File : //usr/local/lp/etc/sonarpush/template/sonarpush-sysvinit

#!/bin/bash
#
# ### BEGIN INIT INFO
# Provides:          sonarpush
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Sonar Monitoring Push daemon
# Description:       LiquidWeb SonarPush Monitoring Daemon.
### END INIT INFO
#
# chkconfig: 2345 11 89
# description: Sonar Monitoring Push daemon

PIDFILE="/usr/local/lp/var/sonarpush/sonarpush.pid"

start()
{
	if [ -e "$PIDFILE" ];
	then
		PID=`cat $PIDFILE | head -n 1 | awk '{print $1}'`
		kill -0 $PID 2> /dev/null
		if [ $? == 0 ];
		then	
			# A process is running, test to see if its sonarpush
			if [[ -n $(grep SonarPush /proc/${PID}/cmdline) ]];
			then
				echo "sonarpush process $PID is already running!";
			else
				echo "PID contained in PID file doesn't point to a running SonarPush daemon. Starting sonarpush."
				rm -f $PIDFILE
				/usr/local/lp/apps/sonarpush/sonarpush
			fi
		else
			rm -f $PIDFILE
			/usr/local/lp/apps/sonarpush/sonarpush
		fi
	else
		/usr/local/lp/apps/sonarpush/sonarpush
	fi
}

stop()
{
	if [ -e "$PIDFILE" ];
	then
		PID=`cat $PIDFILE | head -n 1 | awk '{print $1}'`
		kill -0 $PID 2> /dev/null
		if [ $? == 0 ];
		then
			if [[ -n $(grep SonarPush /proc/${PID}/cmdline) ]];
			then
				kill -HUP $PID
			else
				echo "PID contained in PID file doesn't point to a running SonarPush daemon. Removing PID file."
				rm $PIDFILE
			fi
		else
			echo "process $PID not running"
			rm $PIDFILE
		fi

	else
		echo "PID file '$PIDFILE' does not exist."
	fi
}



# See how we were called.
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    stop
    start
    ;;
  *)
    echo $"Usage: $0 {start|stop|restart}"
    exit 1
esac

exit $?