> im a linux/unix newbie but want to install and have freenet started as a
> daemon at system-boot time. (Runlevel 3+5). i tried something but still
> failed yet to get it to work.

What OS and distro are you using?  Some kind of Unix?  Some kind of Linux?  If
Linux, which distro?  If you're running Gentoo (unlikely), then try installing
Freenet from 'emerge freenet' and run 'rc-update add freenet default'.

Really, without knowing your OS, there's not much help to be had.  If you're
feeling adventurous, you can check out my script below.  The start() function
is probably what you'll want to look at.  Notice the CLASSPATH variable.  You
need to have freenet.jar and freenet-ext.jar in there.

#!/sbin/runscript
# Gentoo freenet init.d-script
#
# This script requires the companion script start-freenet.sh to do it's
# job.  This script is needed to facilitate full logging of freenet.
#
# Also requires the /etc/conf.d/freenet file to be configured correctly.
#
# Gentoo Maintainer: Brandon Low <[EMAIL PROTECTED]>
# Authors: Per Wigren <[EMAIL PROTECTED]>
#          Brandon Low <[EMAIL PROTECTED]>
#

depend() {
        need net
}

check_config() {
        if [ -z "${FREENET_NICENESS}" ] || [ -z "${JAVA_OPTIONS}" ]; then
                eerror "Please set all options in /etc/conf.d/freenet"
                return 1
        fi
        if [ ! -f /etc/freenet.conf ]; then
                eerror "To configure freenet, please run:"
                eerror "# ebuild
/usr/portage/net-p2p/freenet/freenet-[version].ebuild"
                return 1
        fi
        return 0
}

start() {
        JAVA="$(java-config --java)"
        #Uncomment this next line if your JVM doesn't support NPTL and you're
using NPTL
        #export LD_ASSUME_KERNEL=2.4.1

        check_config || return 1

        ebegin "Starting Freenet now"
        if [ ! -f /usr/lib/freenet/freenet-ext.jar ]; then
                 ewarn "freenet-ext.jar not found.  It can be downloaded from"
                 ewarn "http://freenetproject.org/snapshots/freenet-ext.jar";
                 eend 1
                 return 1
        fi
        if [ ! -f /var/freenet/seednodes.ref ]; then
                 ewarn "seednodes.ref not found, you can download some seeds"
                 ewarn "from
http://hawk.freenetproject.org/~freenet4/seednodes.ref";
                 eend 1
                 return 1
        fi

       
CLASSPATH=/usr/lib/freenet/freenet.jar:/usr/lib/freenet/freenet-ext.jar:$CLASSPATH

        # if Sun JDK set -server option as suggested on mailing list
        if [ ! -z "`${JAVA} -help 2>&1 | grep '[-]server'`" ]; then
                JAVA_ARGS="-server"
        else
                JAVA_ARGS=""
        fi
        JAVA_ARGS="${JAVA_ARGS} ${JAVA_OPTIONS}"
        ulimit -n 4096
        # Had to change off of using start-stop-daemon to start it,
        # because of suckage.  This allows us to log the stdout and
        # stderr of freenet.
        export JAVA JAVA_ARGS CLASSPATH
        echo "XXXXXX" > /var/freenet/freenet.pid
        nice -n ${FREENET_NICENESS} sudo -u freenet /usr/bin/start-freenet.sh \
                > /var/freenet/freenet.pid
        sleep 1
        ps ax|grep "^ *$(cat /var/freenet/freenet.pid)" > /dev/null
        eend $?
}

stop() {
        ebegin "Stopping Freenet"
        start-stop-daemon --stop --quiet --pidfile /var/freenet/freenet.pid
        eend $?
}

_______________________________________________
Support mailing list
[EMAIL PROTECTED]
http://news.gmane.org/gmane.network.freenet.support
Unsubscribe at http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/support
Or mailto:[EMAIL PROTECTED]

Reply via email to