centos6.4 NFS服务端快速脚本(渣~)

默认安装centos6.4下NFS配置

#!/bin/bash
function startNFS()
{
echo "#start pormap xvebaoku ${data}" >>/etc/rc.local
echo "/etc/init.d/portmap restart" >>/etc/rc.local
echo "#start nfs xvebaoku ${data}" >>/etc/rc.local
echo "/etc/init.d/nfs restart" >>/etc/rc.local
}
function shedingzhanghaoNFS()
{
useradd -s /sbin/nologin -g www www
WWWID=`grep www /etc/passwd |awk -F : '{print $3}'`
}
function xieruNFS()
{
if [ ! -s /data/www  ];then
mkdir -p /data/www
chown www.www /data/www
echo "/data/www 192.168.99.0/24(rw,sync,anonuid=501,anongid=501)" >>/etc/exports
else
echo "/data/www 192.168.99.0/24(rw,sync,anonuid=501,anongid=501)" >>/etc/exports
fi
if [ ! -s /data/wwwlog  ];then
mkdir -p /data/wwwlog
chown www.www /data/wwwlog
echo "/data/wwwlog 192.168.99.0/24(rw,sync,anonuid=501,anongid=501)" >>/etc/exports
else
echo "/data/wwwlog 192.168.99.0/24(rw,sync,anonuid=501,anongid=501)" >>/etc/exports
fi
if [ ! -s /data/mysql  ];then
mkdir -p /data/mysql
chown www.www /data/mysql
echo "/data/mysql 192.168.99.0/24(rw,sync,anonuid=501,anongid=501)" >>/etc/exports
else
echo "/data/mysql 192.168.99.0/24(rw,sync,anonuid=501,anongid=501)" >>/etc/exports
fi
/etc/init.d/portmap restart
/etc/init.d/nfs restart
}
function zuihoujianchaNFS()
{
tail -1 /etc/exports >/home/NFS.log
tail -4 /etc/rc.local >/home/NFS.log
showmount -e localhost >/home/NFS.log
}
shedingzhanghaoNFS
xieruNFS
startNFS
zuihoujianchaNFS

脚本中定义了三个共享存储位置分别是

/data/www

/data/wwwlog

/data/mysql


你可能感兴趣的:(centos,服务端,快速脚本)