Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > 2fe7b55d975a08fc5b2d766f6d386217 > files > 3

mldonkey-server-3.0.3-1.fc13.i686.rpm

#!/bin/bash
#
# Startup script for Mldonkey
#
# Laurent Culioli <laurent@pschit.net>
#
# chkconfig: - 90 15
# description: Mldonkey is client to access multiple peer-to-peer network
# processname: mldonkey
# config: /etc/sysconfig/mldonkey

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

# User-defined options
. /etc/sysconfig/mldonkey

[ -z $LOGFILE ] && LOGFILE="/dev/null"
[ -z $LOG_TO_SYSLOG ] && LOG_TO_SYSLOG="yes"

RETVAL=0

prog=mldonkey

# Path to the mldonkey binarie.
fullpath=/usr/bin/mlnet

lockfile=/var/lock/subsys/$prog
piddir=/var/run/$prog
pidfile=$piddir/mlnet.pid

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

start() {
       echo -n $"Starting Mldonkey (mlnet): "
       if  status -p $pidfile $prog 2>&1 > /dev/null ; then
	       echo -n $"already started" && warning
       else
	       cd $DIRECTORY
	       daemon --user mldonkey --check mldonkey $NICE "\
			$fullpath \
			-log_to_syslog $LOG_TO_SYSLOG \
			-log_file $LOGFILE \
			-pid $piddir \
			$ADDON_PARAMS > /dev/null 2>&1 & \
			"
	       RETVAL=$?
       fi
       echo
       [ $RETVAL -eq 0 ] && touch $lockfile
       return $RETVAL
}
stop() {
       echo -n $"Stopping Mldonkey (mlnet): "
       if ! status -p $pidfile $prog 2>&1 > /dev/null ; then
	       echo -n $"already stopped" && warning
       else
	       killproc -p $pidfile
	       RETVAL=$?
       fi
       echo
       [ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile
       return $RETVAL
}


# See how we were called.
case "$1" in
        start)
                start
		;;
        stop)
                stop
                ;;
        restart|force-reload)
                stop
                start
                ;;
	reload)
		echo $"reload unimplemented"
		RETVAL=3
		;;
	try-restart|condrestart)
                if status -p $pidfile $prog >/dev/null; then
                    stop
                    start
                else
                    echo $"Mldonkey (mlnet) is stopped"
                fi
                ;;
        status)
	        status -p $pidfile $prog
		;;
        *)
                echo $"Usage: $0 {start|stop|restart|try-restart|status}"
                RETVAL=2
esac
exit $RETVAL