From: Hugo Villeneuve Date: Thu, 29 Aug 2013 02:39:04 +0000 (-0400) Subject: Prevent mountnetfs bootscript from blocking when networking is not up X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=f3e02bb8afd81c78bd4b42cb3d5d87a6a6dc2a05;p=hvlinux.git Prevent mountnetfs bootscript from blocking when networking is not up --- diff --git a/TODO b/TODO index 239f4bc..afae1fb 100644 --- a/TODO +++ b/TODO @@ -52,9 +52,6 @@ -stageX-install: si un package n'est pas disponible, le downloader automatiquement? -Mounting network volumes: check if networking is up. -Aussi, ça bloque quelquefois au démarrage ou au shutdown... - Octave: install gnuplot f2c --> install src/f2c /usr/bin install src/f2c.h /usr/include diff --git a/stage2/bootscripts/mountnetfs b/stage2/bootscripts/mountnetfs index a0c7612..893792f 100755 --- a/stage2/bootscripts/mountnetfs +++ b/stage2/bootscripts/mountnetfs @@ -7,10 +7,19 @@ source /etc/rc.d/init.d/functions log_script_name "$0 $*" +# Load global network parameters +source /etc/sysconfig/network/network-parameters + +# Make sure networking is up. If not, this bootscript will wait forever +if [ ! -f "${NETWORKING_UP_FILE}" ]; then + msg_log "${0}: Network is down" + exit ${EXIT_CODE_WARNING} +fi + mountnetfs_start() { if ! grep -q "_netdev" /etc/fstab; then msg_log "No network filesystem found in fstab" - exit ${EXIT_CODE_WARNING} + exit ${EXIT_CODE_SUCCESS} fi if grep -q "nfs" /etc/fstab; then @@ -20,7 +29,7 @@ mountnetfs_start() { exit ${EXIT_CODE_WARNING} fi - if statusproc rpc.statd | grep -q "not running"; then + if ! statusproc rpc.statd | grep -q "running"; then cmd_run_log_box "Starting rpc.statd" loadproc rpc.statd fi fi @@ -37,7 +46,7 @@ mountnetfs_stop() { # mounted with the _netdev option. NETMOUNTS=`/bin/mount \ | /bin/grep '_netdev\|smbfs\|ncpfs|\coda\|nfs' \ - | /usr/bin/cut -d " " -f 3 | /bin/sed 's/$/ /g'` + | /usr/bin/cut -d " " -f 3 | /bin/sed ':a;$!N;s/\n/ /;ta'` # Check to see if anything was listed from above # (see if anything is actually needs to be unmounted) @@ -45,7 +54,7 @@ mountnetfs_stop() { # There is something mounted # Try and stop processes the nice way # (probably won't work in most cases) - /bin/fuser -TERM -m $NETMOUNTS > /dev/null + /bin/fuser -SIGTERM -km $NETMOUNTS > /dev/null # Check and see if it found anything. If it # did, then give 3 seconds for things to exit @@ -91,7 +100,7 @@ case "$1" in stop) cmd_run_log_box "Unmounting network file systems" mountnetfs_stop - if statusproc rpc.statd | grep -q "running with"; then + if statusproc rpc.statd | grep -q "running"; then cmd_run_log_box "Stopping rpc.statd" killproc rpc.statd fi ;;