把nfs服务创建为脚本

    科技2022-07-11  99

    将nfs服务创建为脚本

    #!/bin/bash #nfs服务 [root@server1 ~]# vim nfs.sh x=/opt/web1 test="<html><head><title>web1</title></head><body><h1>this is web1</h1></body></html>" y=/etc/exports yum -y install rpcbind yum -y install nfs* chkconfig --level 35 nfs on chkconfig --level 35 rpcbind on if [ ! -e $x ] ;then mkdir $x fi cd $x if [ ! -e index.html ] ;then echo $test > index.html fi echo "/opt/web1 192.168.111.10(ro)" > $y systemctl stop firewalld setenforce 0 systemctl start rpcbind systemctl start nfs showmount -e [root@server1 ~]# chmod +x nfs.sh [root@server1 ~]# ./nfs.sh Export list for server1: /opt/web1/index.html 192.168.111.10
    Processed: 0.077, SQL: 8