#!/bin/bash
# pyyim-t
#
# chkconfig: - 45 65
# description: pyyim-t
# processname:pyyim-t
# pidfile: /var/run/pyyim-t.pid

. /etc/rc.d/init.d/functions

start() {
        echo -n $"Starting Yahoo transport: "
	(cd /usr/share/pyyim-t; python ./yahoo.py --background --config=/etc/pyyim-t/config.xml)  && success || failure
        RETVAL=$?
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/pyyim-t
        echo
        return $RETVAL
}

stop() {
        # Stop daemons.
        echo -n "Shutting down Yahoo transport: "
	killproc pyyim-t
        RETVAL=$?
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/pyyim-t
        echo
        return $RETVAL
}

restart() {
        stop
        start
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  condrestart)
        [ -f /var/lock/subsys/pyyim-t ] && restart || :
        ;;
  status)
	status pyyim-t
	RETVAL=$?
	;;
  *)
        echo "Usage: pyyim-t {start|stop|restart|reload|condrestart|status}"
        RETVAL=1
esac

exit $RETVAL
