1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

Initscript fixes, mostly for "stop" action.

Use a local variable $ctdbd so that we always run ctdbd from the the
same place and so that we know what to kill.  This variable respects
the $CTDBD environment variable, which may be used to specify an
alternative location for the daemon.

In the important cases use "pkill -0 -f" to check if ctdbd is
running.  Also, remove the special case for killing ctdbd when running
under valgrind.  The regular case will handle this just fine.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 070305adfe636c2580776e6bf24bb8be06622b86)
This commit is contained in:
Martin Schwenke 2009-06-02 10:01:50 +10:00 committed by Ronnie Sahlberg
parent 7bfc19d635
commit 3dad79b88e

View File

@ -93,6 +93,8 @@ set_retval() {
return $1
}
ctdbd=${CTDBD:-/usr/sbin/ctdbd}
start() {
echo -n $"Starting ctdbd service: "
@ -118,22 +120,24 @@ start() {
case $init_style in
valgrind)
valgrind -q --log-file=/var/log/ctdb_valgrind /usr/sbin/ctdbd --nosetsched $CTDB_OPTIONS
daemon valgrind -q --log-file=/var/log/ctdb_valgrind \
$ctdbd --nosetsched $CTDB_OPTIONS
RETVAL=0
;;
suse)
startproc /usr/sbin/ctdbd $CTDB_OPTIONS
startproc $ctdbd $CTDB_OPTIONS
rc_status -v
RETVAL=$?
;;
redhat)
daemon ctdbd $CTDB_OPTIONS
daemon $ctdbd $CTDB_OPTIONS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ctdb || RETVAL=1
;;
ubuntu)
start-stop-daemon --start --quiet --background --exec /usr/sbin/ctdbd -- $CTDB_OPTIONS
start-stop-daemon --start --quiet --background \
--exec $ctdbd -- $CTDB_OPTIONS
RETVAL=$?
;;
esac
@ -152,7 +156,7 @@ start() {
stop() {
echo -n $"Shutting down ctdbd service: "
ctdb ping >& /dev/null || {
pkill -0 -f $ctdbd || {
echo -n " Warning: ctdbd not running ! "
case $init_style in
suse)
@ -164,20 +168,15 @@ stop() {
esac
return 0
}
ctdb shutdown
ctdb shutdown >/dev/null 2>&1
RETVAL=$?
count=0
if [ "$init_style" = "valgrind" ]; then
# very crude method
sleep 2
pkill -9 -f valgrind
fi
while killall -q -0 ctdbd; do
while pkill -0 -f $ctdbd ; do
sleep 1
count=`expr $count + 1`
count=$(($count + 1))
[ $count -gt 10 ] && {
echo -n $"killing ctdbd "
killall -q -9 ctdbd
pkill -9 -f $ctdbd
pkill -9 -f $CTDB_BASE/events.d/
}
done