From a834040df47887c039ab5ffaf759ceaa43c4e080 Mon Sep 17 00:00:00 2001 From: phil Date: Sat, 26 Feb 2005 02:21:43 +0000 Subject: [PATCH] b=5702 r=jacob Scali's patch to fix a few problems with the init scripts on SLES9: - Sources "/etc/init.d/functions" (doesn't exist on SLES9) - Uses a function called "action" (doesn't exist on SLES9) - The scripts don't have LSB-compliant comments to define what runlevels to run on, dependencies on external subsystems and so on. --- lustre/ChangeLog | 1 + lustre/scripts/lustre | 12 ++++++++++++ lustre/scripts/lustrefs | 52 ++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 58 insertions(+), 7 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 8828480..e37117f 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -38,6 +38,7 @@ tbd Cluster File Systems, Inc. - align r/w RPCs to PTLRPC_MAX_BRW_SIZE boundaries for performance - allow readahead allocations to fail when low on memory (5383) - mmap locking landed again, after considerable improvement (2828) + - fix lustre/lustrefs init scripts for SuSE (patch from Scali, 5702) 2004-11-23 Cluster File Systems, Inc. * version 1.4.0 diff --git a/lustre/scripts/lustre b/lustre/scripts/lustre index a912f07..4278d29 100755 --- a/lustre/scripts/lustre +++ b/lustre/scripts/lustre @@ -8,6 +8,18 @@ # processname: lconf # config: /etc/lustre/config.xml # pidfile: /var/run/lustre.pid +### BEGIN INIT INFO +# Provides: lustre +# Required-Start: +# Required-Stop: +# Should-Start: scance +# Should-Stop: scance +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Lustre Lite network File System. +# Description: This starts both Lustre client and server functions. +### END INIT INFO + SERVICE=lustre LOCK=/var/lock/subsys/$SERVICE diff --git a/lustre/scripts/lustrefs b/lustre/scripts/lustrefs index 8148b75..cfcf7b0 100644 --- a/lustre/scripts/lustrefs +++ b/lustre/scripts/lustrefs @@ -13,23 +13,61 @@ # description: Mounts and unmounts all Lustre mount points. # ### BEGIN INIT INFO -# Provides: $local_fs $remote_fs +# Provides: lustrefs +# Required-Start: $network +# Required-Stop: $network +# Should-Start: +# Should-Stop: +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Mounts and unmounts all Lustre mount points. ### END INIT INFO +## Provides: $local_fs $remote_fs -[ -f /etc/sysconfig/network ] || exit 0 -. /etc/init.d/functions -. /etc/sysconfig/network +# Source function library. +if [ -f /etc/init.d/functions ]; then + . /etc/init.d/functions +fi + +# Source networking configuration. +if [ -f /etc/sysconfig/network ]; then + . /etc/sysconfig/network +fi + +# Source lsb-functions. +if [ -f /lib/lsb/init-functions ]; then + . /lib/lsb/init-functions +fi # Check that networking is up. [ "${NETWORKING}" = "no" ] && exit 0 +# Red Hat has it's own "action"-function for RHGB-messages. +lustre_action () { + STRING=$1 + shift + if [ $(typeset -F action) ]; then + action "$STRING" $* + rc=$? + else + $* + rc=$? + if [ $rc = 0 ]; then + log_success_msg "$STRING" + else + log_failure_msg "$STRING" + fi + fi + return $rc +} + LUSTREFSTAB=`LC_ALL=C awk '!/^#/ && $3 == "lustre" && $4 !~ /noauto/ { print $2 }' /etc/fstab` LUSTREMTAB=`LC_ALL=C awk '!/^#/ && $3 == "lustre" { print $2 }' /proc/mounts` # See how we were called. case "$1" in start) - [ -n "$LUSTREFSTAB" ] && action $"Mounting Lustre filesystems: " mount -a -t lustre + [ -n "$LUSTREFSTAB" ] && lustre_action $"Mounting Lustre filesystems: " mount -a -t lustre touch /var/lock/subsys/lustrefs ;; stop) @@ -40,9 +78,9 @@ case "$1" in while [ -n "$remaining" -a "$retry" -gt 0 ] do if [ "$retry" -lt 3 ]; then - action $"Unmounting Lustre filesystems (retry): " umount -f -a -t lustre + lustre_action $"Unmounting Lustre filesystems (retry): " umount -f -a -t lustre else - action $"Unmounting Lustre filesystems: " umount -a -t lustre + lustre_action $"Unmounting Lustre filesystems: " umount -a -t lustre fi sleep 2 remaining=`LC_ALL=C awk '!/^#/ && $3 ~ /^lustre/ && $2 != "/" {print $2}' /proc/mounts` -- 1.8.3.1