diff options
author | Christian Zoffoli <xmerlin@gentoo.org> | 2005-03-25 02:19:14 +0000 |
---|---|---|
committer | Christian Zoffoli <xmerlin@gentoo.org> | 2005-03-25 02:19:14 +0000 |
commit | 070fb9fa4562108aea15da5ab5c631b85982715e (patch) | |
tree | 33bb33b9713d309832cc4dcfac1ce133294447aa /sys-cluster | |
parent | Added spanish description to the category metadata (diff) | |
download | gentoo-2-070fb9fa4562108aea15da5ab5c631b85982715e.tar.gz gentoo-2-070fb9fa4562108aea15da5ab5c631b85982715e.tar.bz2 gentoo-2-070fb9fa4562108aea15da5ab5c631b85982715e.zip |
improved init script
(Portage version: 2.0.51.19)
Diffstat (limited to 'sys-cluster')
-rw-r--r-- | sys-cluster/fence/ChangeLog | 5 | ||||
-rwxr-xr-x | sys-cluster/fence/files/fenced.rc | 19 | ||||
-rw-r--r-- | sys-cluster/gnbd/ChangeLog | 6 | ||||
-rwxr-xr-x | sys-cluster/gnbd/files/gnbd-client.rc | 44 | ||||
-rwxr-xr-x | sys-cluster/gnbd/files/gnbd-srv.rc | 2 |
5 files changed, 51 insertions, 25 deletions
diff --git a/sys-cluster/fence/ChangeLog b/sys-cluster/fence/ChangeLog index ff6616a867ce..f837858af998 100644 --- a/sys-cluster/fence/ChangeLog +++ b/sys-cluster/fence/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog for sys-cluster/fence # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-cluster/fence/ChangeLog,v 1.10 2005/03/23 14:37:33 xmerlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/fence/ChangeLog,v 1.11 2005/03/25 02:15:31 xmerlin Exp $ + + 25 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> files/fenced.rc: + improved init script 23 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> files/fenced.rc: added gfs filesystems umount support in init (fs mounted by hand) diff --git a/sys-cluster/fence/files/fenced.rc b/sys-cluster/fence/files/fenced.rc index dafb351da0b4..68c7b6abbe09 100755 --- a/sys-cluster/fence/files/fenced.rc +++ b/sys-cluster/fence/files/fenced.rc @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-cluster/fence/files/fenced.rc,v 1.3 2005/03/23 14:37:33 xmerlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/fence/files/fenced.rc,v 1.4 2005/03/25 02:15:31 xmerlin Exp $ depend() { use net @@ -14,17 +14,12 @@ start() { eend $? } -stop() { - - # umount manually mounted gfs filesystems +umount_gfs_filesystems() { local sig retry - local remaining="$(awk '$3 ~ /gfs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" + local remaining="$(awk '$3 ~ /gfs/ { print $2 }' /proc/mounts | sort -r)" - if [ -z "${remaining}" ] + if [ -n "${remaining}" ] then - ebegin "Unmounting GFS filesystems" - eend 0 - else sig= retry=3 while [ -n "${remaining}" -a "${retry}" -gt 0 ] @@ -47,7 +42,13 @@ stop() { sig=-9 done fi +} + +stop() { + # umount GFS filesystems + umount_gfs_filesystems + ebegin "Stopping fence domain" /sbin/fence_tool leave > /dev/null 2>&1 eend $? diff --git a/sys-cluster/gnbd/ChangeLog b/sys-cluster/gnbd/ChangeLog index e7d6c79e95d2..300f80274c77 100644 --- a/sys-cluster/gnbd/ChangeLog +++ b/sys-cluster/gnbd/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for sys-cluster/gnbd # Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-cluster/gnbd/ChangeLog,v 1.3 2005/03/23 14:40:35 xmerlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/gnbd/ChangeLog,v 1.4 2005/03/25 02:17:29 xmerlin Exp $ + + 25 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> files/gnbd-client.rc, + files/gnbd-srv.rc: + improved init script 23 Mar 2005; Christian Zoffoli <xmerlin@gentoo.org> files/gnbd-client.rc: added gfs filesystems (imported GNBSs) umount in init diff --git a/sys-cluster/gnbd/files/gnbd-client.rc b/sys-cluster/gnbd/files/gnbd-client.rc index 6af0a4463a46..042c0fefa606 100755 --- a/sys-cluster/gnbd/files/gnbd-client.rc +++ b/sys-cluster/gnbd/files/gnbd-client.rc @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License, v2 or later -# $Header: /var/cvsroot/gentoo-x86/sys-cluster/gnbd/files/gnbd-client.rc,v 1.3 2005/03/23 14:40:35 xmerlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/gnbd/files/gnbd-client.rc,v 1.4 2005/03/25 02:17:29 xmerlin Exp $ depend() { use dns logger @@ -9,6 +9,29 @@ depend() { need fenced } +load_modules() { + local module modules + modules=$1 + + for module in ${modules}; do + ebegin "Loading ${module} kernel module" + modprobe ${module} + eend $? "Failed to load ${module} kernel module" + done +} + +unload_modules() { + local module modules + modules=$1 + + for module in ${modules}; do + ebegin "Unloading ${module} kernel module" + modprobe -r ${module} + eend $? "Failed to unload ${module} kernel module" + done +} + + start() { if [ ! -f /etc/gnbdtab ] ; then eerror "Please create /etc/gnbdtab" @@ -16,9 +39,7 @@ start() { return 1 fi - ebegin "Loading needed kernel modules for gnbd" - modprobe gnbd - eend $? "Failed to load needed kernel modules for gnbd" + load_modules gnbd GNBD=`cat /etc/gnbdtab | egrep '^import'` if [ -n "$GNBD" ] ; then @@ -31,12 +52,13 @@ start() { stop() { + # umount manually mounted gfs filesystems local sig retry - local remaining="$(awk '$3 ~ /gfs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" + local remaining="$(awk '$3 ~ /gfs/ && $1 ~ /\/dev\/gnbd\// { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" if [ -z "${remaining}" ] then - ebegin "Unmounting GFS filesystems" + ebegin "Unmounting GFS filesystems (GNBDs imported devices)" eend 0 else sig= @@ -53,7 +75,7 @@ stop() { umount ${remaining} &>/dev/null eend $? "Failed to unmount GFS filesystems" fi - remaining="$(awk '$3 ~ /gfs/ { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" + remaining="$(awk '$3 ~ /gfs/ && $1 ~ /\/dev\/gnbd\// { if ($2 != "/") print $2 }' /proc/mounts | sort -r)" [ -z "${remaining}" ] && break /bin/fuser -k -m ${sig} ${remaining} &>/dev/null sleep 5 @@ -62,8 +84,6 @@ stop() { done fi - - local GNBD_MONITOR_PROC ebegin "Unimporting all GNBDs devices" @@ -76,8 +96,6 @@ stop() { killall gnbd_monitor &> /dev/null eend $? fi - - ebegin "Unloading gnbd kernel module" - modprobe -r gnbd - eend $? "Failed to unload gnbd kernel module" + + unload_modules gnbd } diff --git a/sys-cluster/gnbd/files/gnbd-srv.rc b/sys-cluster/gnbd/files/gnbd-srv.rc index 9c0b9d074312..f5dbfff356b9 100755 --- a/sys-cluster/gnbd/files/gnbd-srv.rc +++ b/sys-cluster/gnbd/files/gnbd-srv.rc @@ -1,7 +1,7 @@ #!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License, v2 or later -# $Header: /var/cvsroot/gentoo-x86/sys-cluster/gnbd/files/gnbd-srv.rc,v 1.2 2005/03/23 02:50:37 xmerlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-cluster/gnbd/files/gnbd-srv.rc,v 1.3 2005/03/25 02:17:29 xmerlin Exp $ depend() { use dns logger |