Contents I added in /etc/udev/rules.d/85-my_rule.rules
SUBSYSTEM=="usb", ACTION=="add", ATTR{idVendor}=="1004", ATTR{idProduct}=="61f9", ENV{XAUTHORITY}="/home/andrew/.Xauthority", ENV{DISPLAY}=":0", OWNER="andrew", RUN+="/usr/local/bin/usb-lg-in_udev"
Contents in /usr/local/bin/usb-lg-in_udev
#!/bin/bash
nohup /usr/local/bin/usb-lg-in &
Contents in /usr/local/bin/usb-lg-in
setsid /home/andrew/syncscript/sync.sh
The /home/andrew/syncscript/sync.sh file is a bash file I made that automatically locates and backs up the files.
If I comment out
nohup /usr/local/bin/usb-lg-in &
in
/usr/local/bin/usb-lg-in_udev
nautilus automatically mounts the file
else the process gets blocked, udev is waiting for sync.sh to finish before letting naitulus mount, and sync.sh is waiting for nautilus to mount before quitting.
How do I detach the processes?