You are not logged in.

#1 2010-08-08 16:23:25

wabi
Member
Registered: 2005-04-04
Posts: 72

Server Reboot Shutdown from /etc/rc.d/*

How does Archlinux shutdown?

Does it send a kill -HUP to all processes or does it use the /etc/rc.d/* files and tell them stop?

My problem is, that I have a mongrel_cluster running and it has to be shutdown via this script (otherwise some process.pids files wont get deleted preventing it from starting the next time).
Can I somehow configure this behavior or do I have to live with it that I have to manually delete the process.pids files after every reboot and start these server processes again?

Thanks for any ideas
Wabi

Offline

#2 2010-08-08 16:35:13

.:B:.
Forum Fellow
Registered: 2006-11-26
Posts: 5,819
Website

Re: Server Reboot Shutdown from /etc/rc.d/*

Every daemon is shut down through its script that is located in /etc/rc.d/, what's left then is asked to quit (sighup) and if that doesn't help killed (sigkill).

You could create a daemon script yourself, their setup is quite easy. An alternative would be to put what you need in /etc/rc.local.shutdown (if I have that right).


Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy

Offline

#3 2010-08-10 08:44:07

wabi
Member
Registered: 2005-04-04
Posts: 72

Re: Server Reboot Shutdown from /etc/rc.d/*

so if I understand this correctly an
# /etc/rc.d/mongrelcluster stop
is issued. because if I do this manually I can start the server again with /etc/rc.d/mongrelcluster start but after a reboot I have to go and manually delete some process.pids files.
If this is the same process how come does the result vary systematically?

Last edited by wabi (2010-08-10 10:22:08)

Offline

#4 2010-08-10 13:12:00

jac
Member
From: /home/jac
Registered: 2009-05-19
Posts: 431
Website

Re: Server Reboot Shutdown from /etc/rc.d/*

I'm not sure why there is variance, but I can confirm that "stop" is called on all the daemons, in reverse order as listed in rc.conf:

/etc/rc.shutdown wrote:

# Find daemons NOT in the DAEMONS array. Shut these down first
if [ -d /var/run/daemons ]; then
    for daemon in $(/bin/ls -1t /var/run/daemons); do
        if ! in_array $daemon ${DAEMONS[@]}; then
            stop_daemon $daemon
        fi
    done
fi
# Shutdown daemons in reverse order
let i=${#DAEMONS[@]}-1
while [ $i -ge 0 ]; do
    if [ "${DAEMONS[$i]:0:1}" != '!' ]; then
        ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@}
    fi
    let i=i-1
done

/etc/rc.d/functions wrote:

stop_daemon() {
    /etc/rc.d/$1 stop
}

Do you start it from the daemons array in /etc/rc.conf? Are there any logs you can look at?

Offline

#5 2010-08-12 10:00:40

wabi
Member
Registered: 2005-04-04
Posts: 72

Re: Server Reboot Shutdown from /etc/rc.d/*

Yes I do start the daemon from the DAEMONS array in /etc/rc.conf
Right now I don't have any logs but I'll grab them the next time I reboot.

Offline

#6 2010-08-16 20:06:50

wabi
Member
Registered: 2005-04-04
Posts: 72

Re: Server Reboot Shutdown from /etc/rc.d/*

I made a restart from in front of the computer today and noticed, that it would not shutdown the mongrel processes. I use mongrel_cluster_ctl and my /etc/rc.d/mongrelcluster is a symlink to /usr/bin/mongrel_cluster_ctl a script that anwsers to start|stop|restart.

Offline

#7 2010-08-16 20:34:57

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,797

Re: Server Reboot Shutdown from /etc/rc.d/*

I have a question -- (I am not in front of my machine, so I cannot read the script) -- It looks as if the calling of the stop method of the rc.d scripts depends upon there being an entry in /var/run/daemons. 
Could there be an issue with that file?
Is that the PID that has to be deleted or are you deleting it from a different place?
Any chance that the name is different than the name in the daemons array?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#8 2010-08-16 22:51:04

jac
Member
From: /home/jac
Registered: 2009-05-19
Posts: 431
Website

Re: Server Reboot Shutdown from /etc/rc.d/*

@ewaller, at first I thought that it only did that in the case that it is not in the daemons array, as that is all that code snippet shows. However, on furthur investigation it does the same check for daemons in the array as well.

/etc/rc.d/functions wrote:

ck_daemon() {
    [ -f /var/run/daemons/$1 ] && return 1
    return 0
}

@wabi, does said /usr/bin/mongrel_cluster_ctl create a file named mongrelcluster in /var/run/daemons? Did you do the symlinking, or is the package like that? If it didn't come like that and that is the problem, follow B's suggestion about rc.local.shutdown

Last edited by jac (2010-08-16 22:53:08)

Offline

Board footer

Powered by FluxBB