2017-10-16 85 views
0

我一直在使用脚本centos wiki(方法5)几个月了。几个星期前,它停止工作,看着日志似乎没有发生变量替换。变量替换没有正确发生

这里有一个什么样的脚本,告诉你这样做:

[/etc/auto.master] -- append 
/mnt/smb /etc/auto.smb.top --timeout=600 --ghost 

[/etc/auto.smb.top] -- new file 
* -fstype=autofs,-Dhost=& file:/etc/auto.smb.sub 

[/etc/auto.smb.sub] -- new file 
* -fstype=cifs,rw,credentials=/root/mycreds.txt,uid=500,gid=100 ://${host}/& 

[/root/mycreds.txt] -- new file 
usenrame=username 
password=<secret password> 



然后ls'ing的地方,应挂载的时候,这是输出为journalctl什么:

Oct 16 10:47:47 test.example.com automount[31764]: handle_packet: type = 3 
Oct 16 10:47:47 test.example.com automount[31764]: handle_packet_missing_indirect: token 436, name 172.16.1.105, request pid 31794 
Oct 16 10:47:47 test.example.com automount[31764]: attempting to mount entry /mnt/smb/172.16.1.105 
Oct 16 10:47:47 test.example.com automount[31764]: lookup_mount: lookup(file): looking up 172.16.1.105 
Oct 16 10:47:47 test.example.com automount[31764]: lookup_mount: lookup(file): 172.16.1.105 -> -fstype=autofs,-Dhost=& file:/etc/auto.smb.sub 
Oct 16 10:47:47 test.example.com automount[31764]: parse_mount: parse(sun): expanded entry: -fstype=autofs,-Dhost=172.16.1.105 file:/etc/auto.smb.sub 
Oct 16 10:47:47 test.example.com automount[31764]: parse_mount: parse(sun): gathered options: fstype=autofs,-Dhost=172.16.1.105 
Oct 16 10:47:47 test.example.com automount[31764]: parse_mount: parse(sun): dequote("file:/etc/auto.smb.sub") -> file:/etc/auto.smb.sub 
Oct 16 10:47:47 test.example.com automount[31764]: parse_mount: parse(sun): core of entry: options=fstype=autofs,-Dhost=172.16.1.105, loc=file:/etc/auto.smb.sub 
Oct 16 10:47:47 test.example.com automount[31764]: sun_mount: parse(sun): mounting root /mnt/smb, mountpoint 172.16.1.105, what file:/etc/auto.smb.sub, fstype autofs, options -Dhost=172.16.1.105 
Oct 16 10:47:47 test.example.com automount[31764]: do_mount: file:/etc/auto.smb.sub /mnt/smb/172.16.1.105 type autofs options -Dhost=172.16.1.105 using module autofs 
Oct 16 10:47:47 test.example.com automount[31764]: mount_mount: mount(autofs): mountpoint=/mnt/smb/172.16.1.105 what=file:/etc/auto.smb.sub options=-Dhost=172.16.1.105 
Oct 16 10:47:47 test.example.com automount[31764]: automount_path_to_fifo: fifo name /run/autofs.fifo-mnt-smb-172.16.1.105 
Oct 16 10:47:47 test.example.com automount[31764]: lookup_nss_read_map: reading map file /etc/auto.smb.sub 
Oct 16 10:47:47 test.example.com automount[31764]: do_init: parse(sun): init gathered global options: (null) 
Oct 16 10:47:47 test.example.com automount[31764]: mounted indirect on /mnt/smb/172.16.1.105 with timeout 600, freq 150 seconds 
Oct 16 10:47:47 test.example.com automount[31764]: st_ready: st_ready(): state = 0 path /mnt/smb/172.16.1.105 
Oct 16 10:47:47 test.example.com automount[31764]: ghosting enabled 
Oct 16 10:47:47 test.example.com automount[31764]: dev_ioctl_send_ready: token = 436 
Oct 16 10:47:47 test.example.com automount[31764]: mounted /mnt/smb/172.16.1.105 
Oct 16 10:47:47 test.example.com automount[31764]: handle_packet: type = 3 
Oct 16 10:47:47 test.example.com automount[31764]: handle_packet_missing_indirect: token 437, name Super Secret Dir, request pid 31794 
Oct 16 10:47:47 test.example.com automount[31764]: attempting to mount entry /mnt/smb/172.16.1.105/Super Secret Dir 
Oct 16 10:47:47 test.example.com automount[31764]: lookup_mount: lookup(file): looking up Super Secret Dir 
Oct 16 10:47:47 test.example.com automount[31764]: lookup_mount: lookup(file): Super Secret Dir -> -fstype=cifs,rw,credentials=/root/mycreds.txt,uid=500,gid=100 ://${host}/& 
Oct 16 10:47:47 test.example.com automount[31764]: parse_mount: parse(sun): expanded entry: -fstype=cifs,rw,credentials=/root/mycreds.txt,uid=500,gid=100 ://test/Quickbooks\ Company\ Files 
Oct 16 10:47:47 test.example.com automount[31764]: parse_mount: parse(sun): gathered options: fstype=cifs,rw,credentials=/root/mycreds.txt,uid=500,gid=100 
Oct 16 10:47:47 test.example.com automount[31764]: parse_mount: parse(sun): dequote("://test/Quickbooks\ Company\ Files") -> ://test/Super Secret Dir 
Oct 16 10:47:47 test.example.com automount[31764]: parse_mount: parse(sun): core of entry: options=fstype=cifs,rw,credentials=/root/mycreds.txt,uid=500,gid=100, loc=://test/Super Secret Dir 
Oct 16 10:47:47 test.example.com automount[31764]: sun_mount: parse(sun): mounting root /mnt/smb/172.16.1.105, mountpoint Super Secret Dir, what //test/Super Secret Dir, fstype cifs, options rw,credentials=/root/mycreds.txt,uid=500,gid=100 
Oct 16 10:47:47 test.example.com automount[31764]: do_mount: //test/Super Secret Dir /mnt/smb/172.16.1.105/Super Secret Dir type cifs options rw,credentials=/root/mycreds.txt,uid=500,gid=100 using module generic 
Oct 16 10:47:47 test.example.com automount[31764]: mount_mount: mount(generic): calling mkdir_path /mnt/smb/172.16.1.105/Super Secret Dir 
Oct 16 10:47:47 test.example.com automount[31764]: mount_mount: mount(generic): calling mount -t cifs -s -o rw,credentials=/root/mycreds.txt,uid=500,gid=100 //test/Super Secret Dir /mnt/smb/172.16.1.105/Super Secret Dir 
Oct 16 10:47:47 test.example.com automount[31764]: spawn_mount: mtab link detected, passing -n to mount 
Oct 16 10:47:47 test.example.com automount[31764]: >> Unable to find suitable address. 
Oct 16 10:47:47 test.example.com automount[31764]: mount(generic): failed to mount //test/Super Secret Dir (type cifs) on /mnt/smb/172.16.1.105/Super Secret Dir 
Oct 16 10:47:47 test.example.com automount[31764]: dev_ioctl_send_fail: token = 437 
Oct 16 10:47:47 test.example.com automount[31764]: failed to mount /mnt/smb/172.16.1.105/Super Secret Dir 
Oct 16 10:47:47 test.example.com automount[31764]: handle_packet: type = 3 
Oct 16 10:47:47 test.example.com automount[31764]: handle_packet_missing_indirect: token 438, name Super Secret Dir, request pid 31794 
Oct 16 10:47:47 test.example.com automount[31764]: dev_ioctl_send_fail: token = 438 



从/ var/log/message登录:

Oct 16 11:02:18 test automount[31764]: handle_packet: type = 3 
Oct 16 11:02:18 test automount[31764]: handle_packet_missing_indirect: token 446, name Quickbooks Company Files, request pid 2035 
Oct 16 11:02:18 test automount[31764]: attempting to mount entry /mnt/smb/172.16.1.105/Quickbooks Company Files 
Oct 16 11:02:18 test automount[31764]: lookup_mount: lookup(file): looking up Quickbooks Company Files 
Oct 16 11:02:18 test automount[31764]: lookup_mount: lookup(file): Quickbooks Company Files -> -fstype=cifs,rw,credentials=/root/mycreds.txt,uid=500,gid=100 ://${host}/& 
Oct 16 11:02:18 test automount[31764]: parse_mount: parse(sun): expanded entry: -fstype=cifs,rw,credentials=/root/mycreds.txt,uid=500,gid=100 ://test/Quickbooks\ Company\ Files 
Oct 16 11:02:18 test automount[31764]: parse_mount: parse(sun): gathered options: fstype=cifs,rw,credentials=/root/mycreds.txt,uid=500,gid=100 
Oct 16 11:02:18 test automount[31764]: parse_mount: parse(sun): dequote("://test/Quickbooks\ Company\ Files") -> ://test/Quickbooks Company Files 
Oct 16 11:02:18 test automount[31764]: parse_mount: parse(sun): core of entry: options=fstype=cifs,rw,credentials=/root/mycreds.txt,uid=500,gid=100, loc=://test/Quickbooks Company Files 
Oct 16 11:02:18 test automount[31764]: sun_mount: parse(sun): mounting root /mnt/smb/172.16.1.105, mountpoint Quickbooks Company Files, what //test/Quickbooks Company Files, fstype cifs, options rw,credentials=/root/mycreds.txt,uid=500,gid=100 
Oct 16 11:02:18 test automount[31764]: do_mount: //test/Quickbooks Company Files /mnt/smb/172.16.1.105/Quickbooks Company Files type cifs options rw,credentials=/root/mycreds.txt,uid=500,gid=100 using module generic 
Oct 16 11:02:18 test automount[31764]: mount_mount: mount(generic): calling mkdir_path /mnt/smb/172.16.1.105/Quickbooks Company Files 
Oct 16 11:02:18 test automount[31764]: mount_mount: mount(generic): calling mount -t cifs -s -o rw,credentials=/root/mycreds.txt,uid=500,gid=100 //test/Quickbooks Company Files /mnt/smb/172.16.1.105/Quickbooks Company Files 
Oct 16 11:02:18 test automount[31764]: spawn_mount: mtab link detected, passing -n to mount 
Oct 16 11:02:18 test automount[31764]: >> Unable to find suitable address. 
Oct 16 11:02:18 test automount[31764]: mount(generic): failed to mount //test/Quickbooks Company Files (type cifs) on /mnt/smb/172.16.1.105/Quickbooks Company Files 
Oct 16 11:02:18 test automount[31764]: dev_ioctl_send_fail: token = 446 
Oct 16 11:02:18 test automount[31764]: failed to mount /mnt/smb/172.16.1.105/Quickbooks Company Files 
Oct 16 11:02:18 test automount[31764]: handle_packet: type = 3 
Oct 16 11:02:18 test automount[31764]: handle_packet_missing_indirect: token 447, name Quickbooks Company Files, request pid 2035 
Oct 16 11:02:18 test automount[31764]: dev_ioctl_send_fail: token = 447 



看起来很奇怪的第一件事是它只使用主机的子域。但在这种情况下这并不重要。
因此,如果我将变量名称更改为像TARGET这样的替换为空白:/// Quickbooks \ Company \ Files

回答