[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[plamo:04557] Re: init.d and autofs



面@SGCです。ちょっと長いですが、申し訳ございません。m(__)m

皆様、返答色々ありがとうございます。
Slack系にはinit.dが無いのですね。勉強になります。(^^;

まだ、autofsは動いて無いのですが、中間報告です。

autofsを解凍、展開したところ、/samples/rc.autofsというのがありました。
これを/etc/rc.d/rc.localで起動させようと思いまして、
/etc/rc.d/にコピーして、/rc.localに

---------/etc/rc.d/rc.local-------------

if [ -x /etc/rc.d/rc.autofs ]; then
  echo -n "Starting autofs server "
  /etc/rc.d/rc.autofs start
  echo "."
fi
--------------ここまで------------------

を付け加えました。そして、rc.autofsを変更して起動させようとしたのです
が、
プロセスが立ち上がりません。/var/log/syslogを見ると、

--------------/var/log/syslog----------

Dec	2	15:38:22	yamato	modprobe: Can't locate module autofs	
Dec	2	15:38:22	yamato	automount[188]: >> mount: fs type autofs not
	supported	by	kernel
Dec	2	15:38:22	yamato	automount[188]: /misc: mount failed!			

--------------ここまで------------------

が表示されます。何が間違ってるのでしょう?
なんとか自力で頑張るつもりですが、どなたか指摘していただければ幸いです。

まだまだ勉強不足ですが、よろしくお願いします。m(__)m

以下は、rc.autofsです。

-----------/etc/rc.d/rc.autofs----------
#! /bin/bash	
#	
FLAGS="defaults 21"	

test -f /usr/sbin/automount || exit 0	
PATH=/sbin:/usr/sbin:/bin:/usr/bin	
export PATH	

localoptions=''	

function getmounts()			

if [ -f /etc/auto.master ]			
then			
    cat /etc/auto.master | sed -e '/^#/d' -e '/^$/d'| (			
	while read dir map options		
	do		
	    if [ ! -z "$dir" -a ! -z "$map" \		
			-a x`echo "$map" | cut -c1` != 'x-' ]
	    then	
		map=`echo "/etc/$map" | sed -e 's:^/etc//:/:'`
		options=`echo "$options" | sed -e 's/\(^\|[ \t]\)-/\1/g'`
		if [ -x $map ]; then
		    echo "automount $dir program $map $options $localoptions"
		elif [ -f $map ]; then
		    echo "automount $dir file $map $options $localoptions"
		else
		    echo "automount $dir `basename $map` $options $localoptions"
		fi
	    fi	
	done	
    )		
fi		

if [ -e /usr/bin/ypcat ] && [ `ypcat -k auto.master 2>/dev/null | wc -l`
-gt 0 ]			
then			
    ypcat -k auto.master | (			
	while read dir map options		
	do		
	    if [ ! -z "$dir" -a ! -z "$map" \		
			-a x`echo "$map" | cut -c1` != 'x-' ]
	    then		
		map=`echo "$map" | sed -e 's/^auto_/auto./'`	
		options=`echo "$options" | sed -e 's/\(^\|[ \t]\)-/\1/g'`	
		echo "automount $dir yp $map $options $localoptions"	
	    fi		
	done		
    )			
fi		
}		


function status()		
{		
	echo "Configured Mount Points:"	
	echo "------------------------"	
	getmounts	
	echo ""	
	echo "Active Mount Points:"	
	echo "--------------------"	
	ps ax|grep "[0-9]:[0-9][0-9] automount " | (	
		while read pid tt stat time command; do echo $command; done
	)
}	


function slackware()	
{	

case "$1" in	
  start)	
	# Check if the automounter is already running?
	if [ ! -f /var/lock/automount ]; then	
	    echo 'Starting automounter: '	
	    getmounts | sh	
	    touch /var/lock/automount	
	fi	
	;;	
  stop)		
	killall -TERM automount	
	rm -f /var/lock/automount	
	;;	
  reload|restart)		
	if [ ! -f /var/lock/automount ]; then	
		echo "Automounter not running"
		exit 1
	fi	
	echo "Checking for changes to /etc/auto.master ...."	
	TMP1=`tempfile`;		
	TMP2=`tempfile`;		
	getmounts >$TMP1		
	ps ax|grep "[0-9]:[0-9][0-9] automount " | (		
	    while read pid tt stat time command; do		
		echo "$command" >>$TMP2	
		if ! grep -q "^$command" $TMP2; then	
			kill -USR2 $pid
			echo "Stop $command"
		fi	
	    done		
	)		
	cat $TMP1 | ( while read x; do		
		if ! grep -q "^$x" $TMP2; then	
			$x
			echo "Start $x"
		fi
        done )		
	rm $TMP1 $TMP2	
	;;	
  status)		
	status	
	;;	
  *)		
	echo "Usage: /etc/rc.d/rc.autofs {start|stop|restart|reload|status}"	
	exit 1	
esac		
}		


	slackware "$@"	

exit 0

--------------ここまで------------------
-- 
Kazuki Omo:omok@sgc.com

Follow-Ups
[plamo:04559] Re: init.d and autofs, KOJIMA Mitsuhiro
References
[plamo:04554] Re: init.d and autofs, Chie Nakatani

[検索ページ] [メール一覧]
Plamo ML 公開システム