[DRBD-user] /etc/init.d/drbd script

Lars Ellenberg Lars.Ellenberg at linbit.com
Wed Apr 21 09:54:40 CEST 2004

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


/ 2004-04-20 20:51:02 -0400
\ David Krovich:
> In my drbd debian packages, when I drbd package is removed, first I
> attempt to stop the drbd module using /etc/init.d/drbd stop and then
> remove the package.  This is now causing a problem.  Consider the
> following scenario:
> 
> 1) User installs package.
> 2) User attempts to immediately remove the package.
> 
> When the package is attempted to be removed, the the /etc/init.d/drbd
> script is called with a parameter of stop.  Since the user hasn't
> modified the /etc/drbd.conf script, the parse_config option raises an
> error since the hostname of the host is not in the /etc/drbd.conf file
> so it fails which causes the package removal to fail.
> 
> If the drbd module is not loaded, is it necessary to parse the
> /etc/drbd.conf file?

since the module is loaded if neccessary from /etc/init.d/drbd,
and I need to know the module parameter minor_count, yes, I need
to parse the conf file first.

maybe better place a test -e /proc/drbd in the remove script.
or diff the drbd.conf against the example copy in the documentation.

but you are right, stopping it when unused should not fail.

maybe this is more appropriate:

diff -u -p -r1.56 drbd
--- scripts/drbd	6 Apr 2004 18:52:04 -0000	1.56
+++ scripts/drbd	21 Apr 2004 07:53:37 -0000
@@ -2085,6 +2085,9 @@ if mymatch "$COMMAND" "@(start|stop|rest
 	needs_to_be_root
 fi
 
+test "$link" = drbd -a "$COMMAND" = stop -a ! -e "$PROC_DRBD" &&
+	echo "$link stop: nothing to do" && exit 0
+
 #
 # read pre-parsed config, or if this seems inconsistent,
 # parse again



More information about the drbd-user mailing list