#!/bin/sh
# 
# This file:
# /etc/init.d/epson_pcsvcd
#
# Log Daemon:
# /opt/epson/portcommunicationservice/pcsvc
# Symbolic link of the epuras Daemon:
# /usr/sbin/portcommunicationserviced

### BEGIN INIT INFO
# Provides:          epson_pcsvcd
# Required-Start:    $syslog
# Required-Stop:     $syslog
# Default-Start:     2 3 5
# Default-Stop:      0 1 4 6
# Short-Description: EPSON Port Communication Service
# Description:       EPSON Port Communication Service
### END INIT INFO

# export PCS_SETTING_DIR=
# export PCS_INSTALL_DIR=

PCSVCD_BIN=/usr/sbin/portcommunicationserviced
DESC="EPSON Port Communication Service"

test -x $PCSVCD_BIN || { echo "$DESC not installed";
	if [ "$1" = "stop" ]; then exit 0;
	else exit 5; fi; }


. /etc/rc.status

rc_reset

case "$1" in
	start)
		echo -n "Starting $DESC"
		startproc $PCSVCD_BIN

		# Remember status and be verbose
		rc_status -v
		;;
	stop)
		echo -n "Stopping $DESC"
		killproc -TERM $PCSVCD_BIN

		# Remember status and be verbose
		rc_status -v
		;;
	restart)
		echo -n "Restarting $DESC "$'\n'
		$0 stop
		$0 start
		
		# Remember status
		rc_status
		;;
	reload)
		echo -n "Restarting $DESC "$'\n'
		$0 stop
		$0 start
		
		# Remember status
		rc_status
		;;
	status)
		echo -n "Retrieving $DESC status "
		checkproc $PCSVCD_BIN
		rc_status -v
		;;
	*)
	echo "Usage: $0 {start|stop|status|restart|reload}"
	exit 1
	;;
esac
rc_exit
