You are not logged in.

#1 2008-12-04 17:42:15

dvd100
Member
From: Messina, Italia
Registered: 2008-03-31
Posts: 25
Website

[solved] No daemons stop at the shutdown

Hi!

Little problem here..
When I shutdown (from gnome) the system, the daemons aren't stopped correctly but just killed.. Infact the "[DONE].." screen doesn't appears and at the reboot daemons like amuled said: "remove the ~/.aMule/mulelok file if amuled isn't running.."

How can I resolve? Thank you.

Last edited by dvd100 (2008-12-07 20:10:30)

Offline

#2 2008-12-05 13:46:47

dvd100
Member
From: Messina, Italia
Registered: 2008-03-31
Posts: 25
Website

Re: [solved] No daemons stop at the shutdown

up..

Offline

#3 2008-12-05 14:49:09

Anarconda
Member
Registered: 2002-12-23
Posts: 89

Re: [solved] No daemons stop at the shutdown

I think the problem is amuled, not all daemons. IMO, it's a matter of time. I mean amuled needs a lot of time to close all connections and save all data. Probably the solution comes from to stop amuled manually or insert a sleep sentence in the start/stop script.


Scientia et sapientia patrimonium humanitatis sunt.

Offline

#4 2008-12-05 15:06:54

dvd100
Member
From: Messina, Italia
Registered: 2008-03-31
Posts: 25
Website

Re: [solved] No daemons stop at the shutdown

Thanks for the answer.
I'll try with a 'sleep' sentece!
But why gdm doesn't save the session?

Offline

#5 2008-12-07 20:11:16

dvd100
Member
From: Messina, Italia
Registered: 2008-03-31
Posts: 25
Website

Re: [solved] No daemons stop at the shutdown

Ok, solved adding "sleep 10s" in /etc/rc.d/amuled.

For gdm this is the bug: http://bugzilla.gnome.org/show_bug.cgi?id=552387 I'll wait..

Offline

#6 2009-01-06 16:13:31

gav616
Member
Registered: 2008-01-16
Posts: 182

Re: [solved] No daemons stop at the shutdown

were exactly are you adding sleep 10 to the amuled script?

i use amule-cvs and use the start/stop script from AUR

#!/bin/bash

if [ "$(id -u)" != 0 ]
then
    echo "You must be root to start aMule as daemon."
    exit 2
fi

# general config
USECOLOR="YES"
. /etc/conf.d/amule.conf
. /etc/rc.d/functions

if [ -z $AMULEUSER ]
then
    echo "Unable to run aMule. You must set the user in /etc/conf.d/amule.conf."
    exit 2
elif [[ $AMULEUSER == "root" ]]
then
    echo "Unable to run aMule. You must not run aMule as root."
    exit 2
fi

confdir=$(su -l $AMULEUSER -c "echo ~")/.aMule
logfile=$(su -l $AMULEUSER -c "echo ~")/.aMule/amuled.log
lockfile=$(su -l $AMULEUSER -c "echo ~")/.aMule/muleLock

PID=`pidof -o %PPID /usr/bin/amuled`

[ -f $logfile ] && rm -f $logfile

case "$1" in
    start)
        stat_busy "Starting aMule"
    
    if [ -f $lockfile ]
    then
        stat_fail
        echo "Unable to run aMule, it is already running. If you're sure aMule is not already running, you can remove ${lockfile}."
        exit 2
    fi
    
    [ ! -d $confdir ] && su -l $AMULEUSER  -c "mkdir -p $confdir"

    [ -z "$PID" ] && su -l $AMULEUSER -c "/usr/bin/amuled -o &> $logfile &"
    
    i=0

    while [ "$i" -lt 20 ]
    do
        if [ ! -z "$(grep "No other instances are running." $logfile)" ]
        then
            add_daemon amule
            stat_done
            exit 0
        elif [ ! -z "$(grep "There seems to be an instance of aMule already running" $logfile)" ]
        then
            stat_fail
            exit 2
        else
            i="$(($i+1))"
        fi
    sleep 1
    done
    stat_fail
        ;;
    stop)
        stat_busy "Stopping aMule"
    if [ -f $lockfile ]
    then
        [ ! -z "$PID" ]  && kill $PID &> /dev/null
    else
        stat_fail
        echo "Unable to stop aMule. It is not running."
        exit 2
    fi
        if [ $? -gt 0 ]; then
            stat_fail
        else
            rm_daemon amule
            stat_done
        fi
        ;;
    restart)
        $0 stop
    sleep 1
        $0 start
        ;;
    *)
        echo "usage: $0 {start|stop|restart}"
    ;;
esac
exit 0

.

I get corrupt (journal recover) data at reboot because its closing down too fast.

help! Thank You!

Last edited by gav616 (2009-01-06 17:28:34)

Offline

#7 2009-01-07 17:10:11

dvd100
Member
From: Messina, Italia
Registered: 2008-03-31
Posts: 25
Website

Re: [solved] No daemons stop at the shutdown

 stop)
        stat_busy "Stopping aMule"
    if [ -f $lockfile ]
    then
        [ ! -z "$PID" ]  && kill $PID &> /dev/null
    else
        stat_fail
        echo "Unable to stop aMule. It is not running."
        exit 2
    fi
        if [ $? -gt 0 ]; then
            stat_fail
        else
            rm_daemon amule
            stat_done
        fi
        sleep 10
        ;;

smile

Offline

#8 2009-01-15 14:03:37

gav616
Member
Registered: 2008-01-16
Posts: 182

Re: [solved] No daemons stop at the shutdown

that works when i reboot (i think)

but when i just shutdown its not 'sleep'ing to let amule shutdown properly, thus, i get my journal recovering data from the fast shutdown of amule.

do i need to ad that extra 'sleep 10' above, and then change all the other 'sleep's from '1' to '10' as well?

Last edited by gav616 (2009-01-15 14:04:44)

Offline

#9 2009-01-15 17:20:48

dvd100
Member
From: Messina, Italia
Registered: 2008-03-31
Posts: 25
Website

Re: [solved] No daemons stop at the shutdown

I don't know.. I suggest to ask to the amule package mantainer.  Probably he wrote the init script and he could fix it..

Offline

#10 2009-01-15 21:16:48

wantilles
Member
From: Athens - Greece
Registered: 2007-03-29
Posts: 327

Re: [solved] No daemons stop at the shutdown

Speaking of the package maintainer:

When I took the liberty of making that package I had to make a init script - since I have very little experience about bash - the approach I took was to study the following init scripts:

- the arch init script for mldonkey, gdm and some others
- the debian init script for mldonkey and amule
- the gentoo init script for mldonkey and amule

Now, I know that amule-remote exhibits the behavior (*) you describe here - and so does mldonkey.

I have a dedicated headless 24/7 server that run these all the time for real, so I can try and fix this.

But since I do not have any deeper knowledge of bash, the method I will use will be "trial & error".

I may succeed, I may not.



(*) Except for the data loss.

I have never experienced data loss due to this.

Last edited by wantilles (2009-01-15 21:18:00)

Offline

#11 2009-04-03 13:47:15

vaquerito
Member
Registered: 2008-04-09
Posts: 32

Re: [solved] No daemons stop at the shutdown

yesterday I could stand it no more smile
since the server has good uptime I stopped caring about, but each reboot amule wouldn't start complaining for the mulelock left by fast shutdown.
So, this is my 'stop' section, basically instead of waiting a fixed amount of time we wait 1 sec and then we look again for mulelock existence, but for a maximum amount of ten times to avoid amule preventing machine from shutdown

stop)
        stat_busy "Stopping aMule"
    if [ -f $lockfile ]
    then
        [ ! -z "$PID" ]  && kill $PID &>/dev/null
        count=0
        while [ -f $lockfile ] && [ $count -lt 10 ];
        do
                sleep 1
                let count=$count+1
        done    
    else
        stat_fail
        echo "Unable to stop aMule. It is not running."
        exit 2
    fi
        if [ $? -gt 0 ]; then
            stat_fail
        else
            rm_daemon amule
            stat_done
        fi
        ;;

Hope it helps,
bye

Offline

Board footer

Powered by FluxBB