我在 Samba 共享上有一个文件,有几台计算机将数据附加到该文件。我需要由每台计算机锁定此文件,以便按顺序执行附加操作。我该怎么做?
原因是该文件当时完全乱七八糟。我尝试使用 Samba 选项,但无法解决这个问题。
测试参数:
[global]
netbios name = XXXXXXX
server string = %h server (Samba, Ubuntu)
map to guest = Bad User
obey pam restrictions = Yes
pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
unix password sync = Yes
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
dns proxy = No
usershare allow guests = Yes
panic action = /usr/share/samba/panic-action %d
idmap config * : backend = tdb
[HwInfo]
path = /home/XXXXXXXXX/hw/IN
write list = all
read only = No
create mask = 0644
guest ok = Yes
我创建了下一个脚本:
STR="\n\n\n$1\n\n"
while : ; do
echo -e $STR >> "./temp/info.csv"
done
并在同一台计算机上的几个终端会话中同时运行它。“./temp”是 Samba 共享的挂载点。