#!/bin/bash
#Shell name: conf_nfs.sh # #Program: # configer nsf #Author:pero #Email: #History: # 2012/7/24 # #Usage: vi conf_nfs.sh :set ff=unix # #If you have any opinion please contact mePATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:.
export PATHsoft=$(rpm -qa |grep nfs |wc -l)
if [ $UID -ne 0 ]
then echo "Runing as root" exit 77 firead -p "Please input a real dir in you system to share:" dir
read -p "Please input a subnet like (10.0.0.0/24) to share with net:" netif [ ! -d $dir ]
then echo "dir not found" exit 77 fi if [ $soft -lt 2 ] then yum install nfs-utils-* -y fifile=/etc/exports
if [ -f $file ]
then echo "$dir $net(ro,sync)" >> $file else touch $file echo "$dir $net(ro,sync)" >> $file fi/etc/init.d/nfs restart &> /dev/null
if [ $? -eq 0 ]
then echo "nfs service is start..." exportfs -v else echo "Please check are you $net right? " exit 77 fi