Galera,estou tentado fazer um script em que ao plugar o pendrive no pc, ele sincronizaria os arquivos de determinada pasta do pendrive para o pc.
Criei uma regra udev para que quando o pendrive for conectado o backuppendrive.sh seja executado
Codigo do Script:
#!/bin/bash
LOG=/var/log/backuppendrive.log
exec 1>>${LOG}
exec 2>&1
echo > /var/log/backuppendrive.log
DEVICE="$1"
echo "Dispositivo: $DEVICE"
mount -U 184F39D627BEE814 /mnt/
rsync -uahvP /mnt/ETEC /home/mateus/ETEC/teste
umount /mnt/$DEVICE
exit 0
Log quando o script é executado automaticamente:
Dispositivo: sdb1
fusermount: mount failed: Operation not permitted
sending incremental file list
rsync: link_stat "/mnt/ETEC" failed: No such file or directory (2)
sent 18 bytes received 12 bytes 60.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1189) [sender=3.1.3]
umount: /mnt/sdb1: must be superuser to unmount.
Log quando eu executo o script manualmente:
Dispositivo:
Mount is denied because the NTFS volume is already exclusively opened.
The volume may be already mounted, or another software may use it which
could be identified for example by the help of the 'fuser' command.
sending incremental file list
rsync: link_stat "/mnt/ETEC" failed: No such file or directory (2)
sent 18 bytes received 12 bytes 60.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1189) [sender=3.1.3]
umount: /mnt/: não montado.
O que estou fazendo de errado ?