sudo aptitude install nfs-common
sudo aptitude install smbclient
# 先以 client 确认 server 是否存在 /sbin/showmount 192.168.0.6 >/dev/null 2>&1 if [ "j$?" != "j0" ]; then echo "NFS Server is not exist" exit 1 fi # 重新确认挂载 mount -a >/dev/null 2>&1 if [ "j$?" != "j0" ]; then echo "NFS Server mount failed" exit 1; fi
/*先以 client 确认 server 是否存在*/ $state = shell_exec('/sbin/showmount 192.168.0.6 >/dev/null 2>&1; echo $?'); if(trim($state)!='0'){ echo "NFS Server is not exist"; exit; } /*重新确认挂载*/ if(shell_exec('mount -a 2>&1')){ echo "NFS Server mount failed" exit; }
检查 SAMBA Server 是否存在的流程
以 Shell 的方式检查
# 先以 client 确认 server 是否存在 smbclient -NL //192.168.0.6 >/dev/null 2>&1 if [ "j$?" != "j0" ]; then echo "SAMBA Server is not exist" exit 1 fi # 重新确认挂载 mount -a >/dev/null 2>&1 if [ "j$?" != "j0" ]; then echo "SAMBA Server mount failed" exit 1; fi
/*先以 client 确认 server 是否存在*/ $state = shell_exec('smbclient -NL //192.168.0.6 >/dev/null 2>&1; echo $?'); if(trim($state)!='0'){ echo "SAMBA Server is not exist"; exit; } /*重新确认挂载*/ if(shell_exec('mount -a 2>&1')){ echo "SAMBA Server mount failed" exit; }