2017-10-16 96 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

回答