【文件属性】:
文件名称:mount_nfs.sh
文件大小:892B
文件格式:SH
更新时间:2020-06-30 20:38:29
挂载脚本
#!/bin/sh
#auto get ip
#udhcpc
#config ip netmask gw
#ifconfig eth0 172.20.223.123 netmask 255.255.255.0
#route add default gw 172.20.223.254
serverip=$1
serverpath=$2
localpath=$3
echo "usage:./mount_nfs serverip serverpath localpath"
if [ -z $serverip ]; then
echo "serverip is NULL"
exit 1
fi
if [ -z $serverpath ]; then
echo "serverpath is NULL"
exit 1
fi
if [ -z $localpath ]; then
localpath=/mnt/nfs
echo "localpath default /mnt/nfs"
fi
mount -o nolock,wsize=1024,rsize=1024 $serverip:$serverpath $localpath
if [ $? = 0 ]; then
echo "nfs mount succeed!!"
echo "if you want to umount the serverpath"
echo "please input umount like this: umount /mnt"
else
echo "nfs mount failed,please check and try again!!"
fi