变量替换没有正确发生

时间:2017-10-16 15:34:09

标签: automount

我几个月来一直在使用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

1 个答案:

答案 0 :(得分:0)

这是usenrame的拼写错误吗?您是否为mount命令指定了vers=1.0vers=3.0?我posted a slightly different issue但也许您可以在那里找到答案。

相关问题