尝试了一个小项目来帮助将控制文件从我的家用计算机传输到我的车间计算机。结果让我很困惑。我究竟做错了什么?
家庭计算机在 Windows 下运行 Fusion 360。商店计算机运行 Debian Wheezy 和 rtai for LinuxCNC。它没有网络连接。
Fusion 360 将数控文件生成到 U 盘上,我将 U 盘带到商店进行处理。我希望当我将棒插入商店计算机时,所有 NC 文件都会同步到 LinuxCNC 工作文件夹。
我已经制定了这个 udev 规则 /etc/udev/rules.d/80-LARS.rules
ACTION=="add",SUBSYSTEMS=="usb",ATTRS{idVendor}=="0951",ATTRS{manufacturer}=="Kingston",RUN+="/home/la/synch.sh"
同步工具
#!/bin/sh
logger startsync
sudo rsync -a /media/LARS_GREJOR/NGC/* /home/la/linuxcnc/nc_files/
touch /home/la/now.done
logger donesync
我在系统日志中做了一个标记,然后拔下并重新插入 USB 记忆棒。为什么我的脚本中有这么多系统日志条目?并且不会复制任何文件。如果我手动运行synch.sh,文件就会被复制。
我为组 sudo 设置了 NOPASSWD:ALL。尝试过使用和不使用 sudo 的 rsync 。
la@debianRT:~/linuxcnc/nc_files$logger mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
la@debianRT:~/linuxcnc/nc_files$sudo tail -50 /var/log/syslog
Mar 20 21:46:14 debianRT kernel: [ 2646.615824] FAT-fs (sdb1): utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!
Mar 20 21:47:51 debianRT la: mmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Mar 20 21:48:07 debianRT kernel: [ 2759.410620] usb 1-6: USB disconnect, device number 4
Mar 20 21:48:27 debianRT kernel: [ 2780.064015] usb 1-5: new high-speed USB device number 5 using ehci_hcd
Mar 20 21:48:27 debianRT kernel: [ 2780.198530] usb 1-5: New USB device found, idVendor=0951, idProduct=1603
Mar 20 21:48:27 debianRT kernel: [ 2780.198534] usb 1-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Mar 20 21:48:27 debianRT kernel: [ 2780.198537] usb 1-5: Product: DataTraveler 2.0
Mar 20 21:48:27 debianRT kernel: [ 2780.198539] usb 1-5: Manufacturer: Kingston
Mar 20 21:48:27 debianRT kernel: [ 2780.198541] usb 1-5: SerialNumber: 20070620000000005918801B
Mar 20 21:48:27 debianRT kernel: [ 2780.199267] scsi6 : usb-storage 1-5:1.0
Mar 20 21:48:27 debianRT mtp-probe: checking bus 1, device 5: "/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-5"
Mar 20 21:48:27 debianRT mtp-probe: bus: 1, device: 5 was not an MTP device
Mar 20 21:48:27 debianRT logger: startsync
Mar 20 21:48:27 debianRT logger: donesync
Mar 20 21:48:28 debianRT logger: startsync
Mar 20 21:48:28 debianRT logger: donesync
Mar 20 21:48:28 debianRT logger: startsync
Mar 20 21:48:28 debianRT logger: donesync
Mar 20 21:48:28 debianRT logger: startsync
Mar 20 21:48:28 debianRT logger: donesync
Mar 20 21:48:28 debianRT logger: startsync
Mar 20 21:48:28 debianRT kernel: [ 2781.196803] scsi 6:0:0:0: Direct-Access Kingston DataTraveler 2.0 1.00 PQ: 0 ANSI: 2
Mar 20 21:48:28 debianRT kernel: [ 2781.197395] sd 6:0:0:0: Attached scsi generic sg2 type 0
Mar 20 21:48:28 debianRT kernel: [ 2781.200667] sd 6:0:0:0: [sdb] 7888896 512-byte logical blocks: (4.03 GB/3.76 GiB)
Mar 20 21:48:28 debianRT kernel: [ 2781.201159] sd 6:0:0:0: [sdb] Write Protect is off
Mar 20 21:48:28 debianRT kernel: [ 2781.201163] sd 6:0:0:0: [sdb] Mode Sense: 23 00 00 00
Mar 20 21:48:28 debianRT kernel: [ 2781.201660] sd 6:0:0:0: [sdb] No Caching mode page present
Mar 20 21:48:28 debianRT kernel: [ 2781.201664] sd 6:0:0:0: [sdb] Assuming drive cache: write through
Mar 20 21:48:28 debianRT kernel: [ 2781.204289] sd 6:0:0:0: [sdb] No Caching mode page present
Mar 20 21:48:28 debianRT kernel: [ 2781.204294] sd 6:0:0:0: [sdb] Assuming drive cache: write through
Mar 20 21:48:28 debianRT kernel: [ 2781.322475] sdb: sdb1
Mar 20 21:48:28 debianRT kernel: [ 2781.324537] sd 6:0:0:0: [sdb] No Caching mode page present
Mar 20 21:48:28 debianRT kernel: [ 2781.324541] sd 6:0:0:0: [sdb] Assuming drive cache: write through
Mar 20 21:48:28 debianRT kernel: [ 2781.324544] sd 6:0:0:0: [sdb] Attached SCSI removable disk
Mar 20 21:48:28 debianRT logger: donesync
Mar 20 21:48:28 debianRT logger: startsync
Mar 20 21:48:29 debianRT logger: donesync
Mar 20 21:48:29 debianRT logger: startsync
Mar 20 21:48:29 debianRT logger: startsync
Mar 20 21:48:29 debianRT logger: startsync
Mar 20 21:48:29 debianRT logger: startsync
Mar 20 21:48:29 debianRT logger: donesync
Mar 20 21:48:29 debianRT logger: donesync
Mar 20 21:48:29 debianRT logger: donesync
Mar 20 21:48:29 debianRT logger: donesync
Mar 20 21:48:29 debianRT logger: startsync
Mar 20 21:48:29 debianRT logger: donesync
Mar 20 21:48:29 debianRT logger: startsync
Mar 20 21:48:29 debianRT logger: donesync
Mar 20 21:48:29 debianRT kernel: [ 2782.085316] FAT-fs (sdb1): utf8 is not a recommended IO charset for FAT filesystems, filesystem will be case sensitive!
la@debianRT:~/linuxcnc/nc_files$