#!/bin/bash  
#  
# JYNGJCZ 
# chkconfig: 2345 99 01
# description: jingyunsd service, dealing with the virus

### BEGIN INIT INFO
# Provides:          JYNGJCZ
# Required-Start:    $local_fs $network
# Required-Stop:     $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: jingyunsd service
# Description:       jingyunsd service, dealing with the virus
### END INIT INFO  

SNAME=JYNGJCZ2
PROG=/opt/apps/com.vsecure.chenxinsd/files/$SNAME  

start() {  
#check the daemon status first  
	PID=`pidof $SNAME`
	if [ "$PID" = "" ] ; then
		$PROG  
		echo "start $SNAME"
	else
		echo "$SNAME already running"
	fi
}  

stop() {  
	PID=`pidof $SNAME`
	if [ "$PID" = "" ] ; then
		echo "$SNAME not running"
	else
		kill -9 `pidof $SNAME`
	fi
}  

status(){
	PID=`pidof $SNAME`
	if [ "$PID" = "" ] ; then
		echo "$SNAME not running"
	else
		echo "$SNAME is running"
	fi
}

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