#!/bin/bash
# chkconfig: 234 99 00
# description: A boot script for the Freevo record server.
#
# This file may be placed in your system's init.d startup directory and
# setup to start at the appropriate runlevels.  You may instead use the
# record_server_init script to be run from init.  Init will keep an eye
# on your process and restart it if it fails.
#
# There is a file called boot_config which can be found in the boot/ 
# directory of Freevo.  This file should be copied to /etc/freevo/boot_config
# and edited to suit your needs.
#
# $Id: recordserver 3925 2003-10-05 19:50:34Z rshortt $

# Get startup config file
test -f /etc/freevo/boot_config || exit 0
. /etc/freevo/boot_config

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
DAEMON_START="$FREEVO_HOME/freevo recordserver start"
DAEMON_STOP="$FREEVO_HOME/freevo recordserver stop"
NAME="record server"

test -f $DAEMON || exit 0


case "$1" in
  start)
    echo -n "Starting $NAME: "
    $DAEMON_START 2>&1 > /dev/null
    echo "done."
    ;;
  stop)
    echo -n "Stopping $NAME: "
    $DAEMON_STOP 2>&1 > /dev/null
    echo "done."
    ;;
  status)
    echo
    echo "Possible process list, if any:"
    echo
    ps -ef | grep record_server | egrep -v 'start|stop|status|tail|less|grep'
    ;;
  restart)
    echo "Restarting..."
    $0 stop
    sleep 3
    $0 start
    ;;
  *)
    echo "Usage: $0 {start|stop|status|restart}" >&2
    exit 1
    ;;
esac

exit 0
