Y
Y
yahabrovec2019-01-15 21:09:37
linux
yahabrovec, 2019-01-15 21:09:37

Creating a udev rule for flash drive backup?

I have a need for an automatic backup of a flash drive when it is inserted into a USB port. Googling found out that you need to use linux udev rules. First I created it myself, then copy-pasted. In the end, neither worked.
Here is the content of the udev file located in the /etc/udev/rules.d/ folder

ACTION=="add", ATTRS{idVendor}=="0x058f", ATTRS{idProduct}=="0x6387",  RUN+="/home/hasan/backup.sh"<code><br>

Вот сам скрипт который должен запускаться.
cp /media/имя юзера/имя флешки/* /home/

Если запустить скрипт сам по себе то все заработает, но не при втыкании флешки. Помогите может кто сталкивался с такой проблемой, где логи посмотреть или что исправить?
P.S пробывал использовать утилиту Rsync, для резервного копирования, но результат такой же. Сам работает, но правило udev нет.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pfg21, 2019-01-15
@pfg21

the rule needs to be debugged
Checking the rules before loading - maybe something udevd considers wrong.

R
Radjah, 2019-01-16
@Radjah

When a device with VID:PID appears, the required script is launched. What do you not like?
There is nothing about mounting in the script.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question