Sophie

Sophie

distrib > Fedora > 13 > i386 > media > os > by-pkgid > aa40922c603c5d347476ca9557ab4b4f > files > 2

poker-bot-1.7.3-3.fc12.noarch.rpm

#!/bin/sh
#
# poker-bot    poker-network bots
#
# chkconfig:   - 70 30
# description: Multi player online poker server with \
#              bots running according to /etc/poker-network

### BEGIN INIT INFO
# Provides: poker-bot
# Required-Start: $local_fs $network $syslog poker-server
# Required-Stop: $local_fs $network $syslog poker-server
# Short-Description: poker-network bots
# Description: Multi player online poker server with
#              bots running according to /etc/poker-network
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

exec="/usr/lib/python2.6/site-packages/pokernetwork/pokerbot.py"
prog=poker-bot
config=/etc/poker-network/poker.bot.xml

[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog

lockfile=/var/lock/subsys/$prog
pidfile=/var/run/poker-network/$prog.pid
logfile=/var/log/poker-network/$prog.log

start() {
    [ -f $exec ] || exit 5
    [ -f $config ] || exit 6
    echo -n $"Starting $prog: "
    daemon --user=poker /usr/bin/poker-bot-selinux \
            --pidfile=$pidfile --logfile=$logfile \
            --quiet --no_save --reactor=poll
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
}

stop() {
    echo -n $"Stopping $prog: "
    killproc -p $pidfile $prog
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
}

restart() {
    stop
    start
}

reload() {
    restart
}

force_reload() {
    restart
}

rh_status() {
    status -p $pidfile $prog
}

rh_status_q() {
    rh_status >/dev/null 2>&1
}


case "$1" in
    start)
        rh_status_q && exit 0
        $1
        ;;
    stop)
        rh_status_q || exit 0
        $1
        ;;
    restart)
        $1
        ;;
    reload)
        rh_status_q || exit 7
        $1
        ;;
    force-reload)
        force_reload
        ;;
    status)
        rh_status
        ;;
    condrestart|try-restart)
        rh_status_q || exit 0
        restart
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
        exit 2
esac
exit $?