[Pkg-samba-maint] r2677 - trunk/ctdb/debian
mparent-guest at alioth.debian.org
mparent-guest at alioth.debian.org
Sat Mar 28 18:06:44 UTC 2009
Author: mparent-guest
Date: 2009-03-28 18:06:44 +0000 (Sat, 28 Mar 2009)
New Revision: 2677
Modified:
trunk/ctdb/debian/changelog
trunk/ctdb/debian/ctdb.init
Log:
ctdb.init: update as in https://bugzilla.samba.org/show_bug.cgi?id=6225
Modified: trunk/ctdb/debian/changelog
===================================================================
--- trunk/ctdb/debian/changelog 2009-03-28 17:59:35 UTC (rev 2676)
+++ trunk/ctdb/debian/changelog 2009-03-28 18:06:44 UTC (rev 2677)
@@ -5,13 +5,12 @@
- updated ctdb.init (from 1.0.75)
* fix debian/uupdate-wrapper to use "git clone" instead of "git-clone"
* Updated Standards-Version to 3.8.1: no changes
- * ctdb.init:
+ * ctdb.init: update as in https://bugzilla.samba.org/show_bug.cgi?id=6225
- Default-Stop: 0 1 6
- - Should-{Start,Stop}: samba
- renamed functions: start -> start_server, stop -> stop_server
* debian/copyright: adding Michael Adam to upstream authors
- -- Mathieu Parent <math.parent at gmail.com> Sat, 28 Mar 2009 18:53:30 +0100
+ -- Mathieu Parent <math.parent at gmail.com> Sat, 28 Mar 2009 19:02:21 +0100
ctdb (1.0.73-1) unstable; urgency=low
Modified: trunk/ctdb/debian/ctdb.init
===================================================================
--- trunk/ctdb/debian/ctdb.init 2009-03-28 17:59:35 UTC (rev 2676)
+++ trunk/ctdb/debian/ctdb.init 2009-03-28 18:06:44 UTC (rev 2677)
@@ -13,8 +13,6 @@
# Provides: ctdb
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
-# Should-Start: samba
-# Should-Stop: samba
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop ctdb service
@@ -30,15 +28,69 @@
test -x $DAEMON || exit 0
-# Source function library.
+#LSB
if [ -f /lib/lsb/init-functions ] ; then
. /lib/lsb/init-functions
-elif [ -f /etc/init.d/functions ] ; then
+fi
+if ! type 'log_daemon_msg' >/dev/null; then
+ log_daemon_msg () {
+ if [ -z "${1:-}" ]; then
+ return 1
+ fi
+
+ if [ -z "${2:-}" ]; then
+ echo -n "$1:"
+ return
+ fi
+
+ echo -n "$1: $2"
+ }
+fi
+if ! type 'log_progress_msg' >/dev/null; then
+ log_progress_msg () {
+ if [ -z "${1:-}" ]; then
+ return 1
+ fi
+ echo -n " $@"
+ }
+fi
+if ! type 'log_end_msg' >/dev/null; then
+ log_end_msg () {
+ # If no arguments were passed, return
+ if [ -z "${1:-}" ]; then
+ return 1
+ fi
+
+ retval=$1
+
+ if [ $1 -eq 0 ]; then
+ echo "."
+ elif [ $1 -eq 255 ]; then
+ /bin/echo -e " (warning)."
+ else
+ /bin/echo -e " failed!"
+ fi
+ return $retval
+ }
+fi
+
+# Source function library.
+if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
fi
+#gettext
+if [ -f /usr/bin/gettext.sh ] ; then
+ . /usr/bin/gettext.sh
+fi
+if ! type 'eval_gettext' >/dev/null; then
+ eval_gettext() {
+ echo -n "$1" | (export PATH `envsubst --variables "$1"`; envsubst "$1")
+ }
+fi
+
[ -f /etc/rc.status ] && {
. /etc/rc.status
rc_reset
@@ -109,13 +161,11 @@
}
running() {
- ps -e | awk '{print $4}' | grep "^ctdbd$" > /dev/null && return 0
- return 1
+ ctdb ping > /dev/null 2>&1 || return 1
+ return 0
}
start_server() {
- killall -q ctdbd
-
# check all persistent databases that they look ok
case $init_style in
ubuntu)
@@ -187,7 +237,7 @@
sleep 1
count=`expr $count + 1`
[ $count -gt 10 ] && {
- echo -n "killing ctdbd "
+ eval_gettext "killing ctdbd "
killall -q -9 ctdbd
pkill -9 -f $CTDB_BASE/events.d/
}
@@ -208,19 +258,9 @@
return $RETVAL
}
-restart_server() {
- stop_server
- start_server
-}
-
-status() {
- ctdb status
-}
-
-
case "$1" in
- start)
- log_daemon_msg "Starting $DESC " "$NAME"
+ start)
+ log_daemon_msg "Starting $DESC " "$NAME"
# Check if it's running first
if running ; then
log_progress_msg "already running"
@@ -233,13 +273,10 @@
else
# Either we could not start it or it is not running
# after we did
- # NOTE: Some servers might die some time after they start,
- # this code does not try to detect this and might give
- # a false positive (use 'status' for that)
log_end_msg 1
fi
- ;;
- stop)
+ ;;
+ stop)
log_daemon_msg "Stopping $DESC" "$NAME"
if running ; then
# Only stop the server if we see it running
@@ -251,33 +288,54 @@
log_end_msg 0
exit 0
fi
- ;;
- restart|force-reload)
+ ;;
+ restart|reload|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
running && stop_server
start_server
running
log_end_msg $?
- ;;
- status)
-
+ ;;
+ status)
log_daemon_msg "Checking status of $DESC" "$NAME"
if running ; then
log_progress_msg "running"
- echo
- status
+ echo
+ ctdb status
log_end_msg 0
else
log_progress_msg "not running"
- log_end_msg 0
- exit 3
+ log_end_msg 1
+ exit 1
fi
+ ;;
+ condrestart)
+ if running ; then
+ log_daemon_msg "Restarting $DESC" "$NAME"
+ stop_server
+ start_server
+ log_end_msg $?
+ fi
+ ;;
+ cron)
+ # used from cron to auto-restart ctdb
+ if ! running ; then
+ log_daemon_msg "Starting $DESC " "$NAME"
+ if start_server && running ; then
+ # It's ok, the server started and is running
+ log_end_msg 0
+ else
+ # Either we could not start it or it is not running
+ # after we did
+ log_end_msg 1
+ fi
+ fi
;;
- *)
- N=/etc/init.d/$NAME
- echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
- exit 1
- ;;
+ *)
+ eval_gettext "Usage: $0 {start|stop|restart|status|cron|condrestart}" >&2
+ echo >&2
+ exit 1
+ ;;
esac
exit $?
More information about the Pkg-samba-maint
mailing list