1.autofs安装
https://www.cndba.cn/hbhe0316/article/106528
https://www.cndba.cn/hbhe0316/article/106528
#yum install autofs –y
2.编辑文件https://www.cndba.cn/hbhe0316/article/106528https://www.cndba.cn/hbhe0316/article/106528
#cat /etc/auto.master | grep -i "pgmcifs"
/- /etc/auto.pgmcifs
#cat /etc/auto.pgmcifs
/home/PGM/Server -fstype=cifs,rw,domain=.,username=username,password=password,sec=ntlmssp,uid=2011,gid=5001,file_mode=0755,dir_mode=0755,vers=3.0 ://xx.xx.xx.xxx/Server
3.重启autofs
https://www.cndba.cn/hbhe0316/article/106528
#systemctl enable autofs.service
#systemctl restart autofs.service
- 针对autofs开启日志,打开autofs日志后,日志会打印到/var/log/message下。
#vi /etc/autofs.conf logging = debug
#systemctl restart autofs.service
重启autofs生效https://www.cndba.cn/hbhe0316/article/106528
- 针对autofs网络抓包,enp0s8为实际的网卡名称。
#tcpdump -i enp0s8 -w /tmp/tcpdump.cap &
6.重启重现时候停止脚本,脚本每隔十分钟检查一次是否重现问题,如果重现问题,则kill掉tcpdump命令。https://www.cndba.cn/hbhe0316/article/106528https://www.cndba.cn/hbhe0316/article/106528
#chmod +x /home/tcpdump.sh
#cat /home/tcpdump.sh
#!/bin/sh
cd /home/PGM/Server > /dev/null 2>&1
if [[ $? -ne 0 ]];then
kill -9 `ps -ef | grep tcpdump | grep -v grep | awk -F ' ' {'print $2'}`
fi
cd /
#crontab –l
*/10 * * * * /home/tcpdump.sh
7.autofs配置timeout参数,如果TIMEOUT=0,则表示umount掉挂在目录,默认TIMEOUT=300,表示默认5分钟umount掉挂载掉。https://www.cndba.cn/hbhe0316/article/106528
https://www.cndba.cn/hbhe0316/article/106528
#cat /etc/autofs.conf | grep -w timeout | grep -v "#"
timeout = 300
该设置需要重启autofs生效。
#systemctl restart autofs.service
版权声明:本文为博主原创文章,未经博主允许不得转载。
Linux