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

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

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

stop() {
        # Stop daemons.
        echo -n "Shutting down ICQ transport: "
	killproc pyicq-t
        RETVAL=$?
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/pyicq-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/pyicq-t ] && restart || :
        ;;
  status)
	status pyicq-t
	RETVAL=$?
	;;
  *)
        echo "Usage: pyicq-t {start|stop|restart|reload|condrestart|status}"
        RETVAL=1
esac

exit $RETVAL
