#!/bin/bash
	#
	# chkconfig: 2345 80 05
	# Description: assp init.d script
	# Hacked by : How2CentOS - http://www.how2centos.com
	#           : T.Eckardt 2010/08/07
	# 

        # set the assp base directory to your needs
	asspbase=/opt/assp

	# Get function from functions library
	. /etc/init.d/functions

	# Start the service assp
	start() {
	        echo -n "Starting assp server: "
	        cd $asspbase
	        /usr/local/bin/perl assp.pl 2>&1 > /dev/null &
	        ### Create the lock file ###
	        touch /var/lock/subsys/assp
	        success $"assp server startup"
	        echo
	}
	 
	# Stop the service assp
	stop() {
	        echo -n "Stopping assp server: "
		killproc -p $asspbase/pid
		sleep 5
	        ### Now, delete the lock file ###
	        rm -f /var/lock/subsys/assp
	        success $"assp server shutdown"
	        echo
	}
	
	# restart the service
	restart() {
		stop
		start
	}

	### main logic ###
	case "$1" in
	  start)
	        start
	        ;;
	  stop)
	        stop
	        ;;
	  restart)
		restart
		;;        
	  status)
	        status -p $asspbase/pid assp
	        ;;
	  *)
	        echo $"Usage: $0 {start|stop|restart|status}"
	        exit 1
	esac
	 
	exit 0
