aprica_Debian.sh


max21 Unternehmensgruppe
#!/bin/bash
#
# /etc/rc.d/init.d/aprica
#
# Starts/stops Aprica
#
#
### BEGIN INIT INFO
# Provides:                     aprica
# Required-Start:               httpd2 mysql
# X-UnitedLinux-Should-Start:   httpd2 mysql
# Required-Stop:                
# X-UnitedLinux-Should-Stop:
# Default-Start:                3 5
# Default-Stop:                 0 1 2 6
# Short-Description:            Aprica
# Description:                  Start/Stop the aprica deamon; Template for Scripts/Aprica2/addMandant.sh
### END INIT INFO
usage()
{
	echo "Usage: $0 {start|stop|restart|status}"
	exit 1
}
export PATH=/root/GNUstep/Tools:/usr/GNUstep/Local/Tools:/usr/GNUstep/System/Tools:/sbin:/bin:/usr/sbin:/usr/bin:/usr/bin/X11:/usr/local/sbin:/usr/local/bin
TOOLS_ON=/usr/GNUstep/Local/Tools/apr$INTARS_MANDANT.sh
if [ ! -x $TOOLS_ON ] ; then
  echo $TOOLS_ON not found/not executable
  rc_failed 5
  rc_status -v1
  rc_exit
fi
RETVAL=0
case "$1" in
start)
	echo -n "Starting Aprica2$INTARS_MANDANT "
	
	$0 status &> /dev/null
	RETVAL=$?
	if [ $RETVAL -eq 1 ] ; then
	  start-stop-daemon --quiet --start -b --exec $TOOLS_ON
	  RETVAL=$?
	else
	  echo "...already started."
	  exit 0
        fi
	if [ $RETVAL -ne 0 ]; then
	  echo "...failed."
          exit 1
	fi
	echo "...started."
        exit 0
	;;
stop)
	echo -n "Shutting down Aprica$INTARS_MANDANT "
	echo -n "$TOOLS_ON"
	start-stop-daemon --quiet --stop --name apr$INTARS_MANDANT.sh
	echo -n "Aprica$INTARS_MANDANT "
	start-stop-daemon --quiet --stop --name Aprica2$INTARS_MANDANT
	$0 status &> /dev/null
	RETVAL=$?
	if [ $RETVAL -eq 1 ] ; then
	  echo "...stopped."
	  exit 0
	else
	  echo "...failed."
	  exit 1
	fi
	;;
reload|restart)
    echo "Restarting Aprica2$INTARS_MANDANT "
	$0 stop
	$0 start
	RETVAL=$?
	exit $RETVAL
	;;
status)
    echo -n "Checking Aprica2$INTARS_MANDANT "
	INTARS_PID=`pgrep apr$INTARS_MANDANT.sh`
	if [ ! -z "$INTARS_PID" ] ; then
	  RETVAL=0
	  echo "running."
        else
	  RETVAL=1
	  echo "unused."
	fi
	exit $RETVAL
	;;
*)
	usage
	;;
esac
Foto