I am trying to run a script from a udev rule after any USB drive has been plugged in.
When I run the script manually, after the USB is mounted normally, it will run fine. The script calls a python program to run and the python program uses a file on the USB drive. No issues there. If I make the script to simply log the date in a file, that works just fine. So I know my UDEV rule and my script work fine, each on their own.
The issue seems to come up when udev calls the script, then script calling the python program and the python program does not run right. I believe it to be that the USB drive has not finished mounting before the python script runs. When watching top, my script begins to run, then python begins to run, they both end, and then I get the window popup of my accessing the files on my USB drive.
So I tried having script1.sh call script2.sh call python.py. I tried having script.sh call python1.py call python2.py. I tried adding sleep function both in the script.sh and python.py. I tried in the rule, RUN+="/home/pi/script.sh & exit". I tried exit in the files. I tried disown in the files.
What else can I try?