From 553359141549f9aa4778086f70e35c59eaffe297 Mon Sep 17 00:00:00 2001 From: kueller Date: Thu, 4 Feb 2010 09:40:29 +0000 Subject: [PATCH] automount in neuer version wesentlich naeher an sun. Das macht einen komplett neuen startup notwendig git-svn-id: svn://svn.compuextreme.de/Viitor/V962/Viitor_autofs@5336 504e572c-2e33-0410-9681-be2bf7408885 --- etc/init.d/autofs | 95 +++++++++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 41 deletions(-) diff --git a/etc/init.d/autofs b/etc/init.d/autofs index fa3e522..472f52a 100644 --- a/etc/init.d/autofs +++ b/etc/init.d/autofs @@ -39,52 +39,65 @@ # -initmount() -{ - MOUNTSOURCE=$1 - AUTOMOUNTSOURCE=$2 - - - sed -e '/^#/d' |\ - sed -e '/^ *$/d' >/tmp/autofs - exec 3&- - rm /tmp/autofs -} - - source /etc/sysconfig/autofstime - +source /etc/sysconfig/autofstime source /etc/init.d/functions + case "$1" in start) - if [ -f /etc/nsswitch.conf ]; then - for MOUNTSOURCE in `grep automount /etc/nsswitch.conf | awk '{ $1=""; print; };'`; do - case "$MOUNTSOURCE" in - files) - if [ -f /etc/sysconfig/auto.master ]; then - cat /etc/sysconfig/auto.master| initmount files file - fi - ;; - nis) - ypcat -k auto.master 2>/dev/null| initmount nis yp - ;; - default) - echo "no such source for automount: "$MOUNTSOURCE - esac - done - fi + if [ -f /etc/sysconfig/auto.master ] && grep automount /etc/nsswitch.conf|grep -q files; then + if [ -f /var/run/autofs/automount_files.pid ]; then + if ps -ef|awk '{print $2}'|grep -q `cat /var/run/autofs/automount_files.pid`; then + echo -n "Automount already running" + print_status failure + exit 10 + else + echo -n "Removing old files" + rm /var/run/autofs/automount_files.pid + fi + fi + echo -n "Starting automount for local auto.master" + automount -v -p /var/run/autofs/automount_files.pid -t $TIMEOUT /etc/sysconfig/auto.master + evaluate_retval + fi + if grep automount /etc/nsswitch.conf|grep -q nis; then + if [ -f /var/run/autofs/automount_nis.pid ]; then + if ps -ef|awk '{print $2}'|grep -q `cat /var/run/autofs/automount_nis.pid`; then + echo -n "Automount for nis already running" + print_status failure + exit 10 + else + echo -n "Removing old files" + rm /var/run/autofs/automount_nis.pid + fi + fi + echo -n "Starting automount for nis" + automount -C -v -v -p /var/run/autofs/automount_nis.pid -t $TIMEOUT auto.master + evaluate_retval + fi ;; stop) - echo -n "shutting down autofs" - pkill automount - evaluate_retval + if [ -f /var/run/autofs/automount_files.pid ]; then + if ps -ef|awk '{print $2}'|grep -q `cat /var/run/autofs/automount_files.pid`; then + echo -n "shutting down autofs" + kill `cat /var/run/autofs/automount_files.pid` + evaluate_retval + else + echo -n "PID `cat /var/run/autofs/automount_files.pid` not existing - cleaning up" + rm /var/run/autofs/automount_files.pid + evaluate_retval + fi + fi + if [ -f /var/run/autofs/automount_nis.pid ]; then + if ps -ef|awk '{print $2}'|grep -q `cat /var/run/autofs/automount_nis.pid`; then + echo -n "shutting down autofs" + kill `cat /var/run/autofs/automount_nis.pid` + evaluate_retval + else + echo -n "PID `cat /var/run/autofs/automount_nis.pid` not existing - cleaning up" + rm /var/run/autofs/automount_nis.pid + evaluate_retval + fi + fi ;; restart) $0 stop