0

I'm running Ubuntu Server and have a python script I am trying to have automatically run when a USB drive is plugged in, however the script is not run when usbmount executes its run-parts command. If I run run-parts myself the script runs fine. I have put in some logging into my bash script and it shows that the script is actually being called when a usb drive is plugged in, it just doesn't execute my python script.

I've been pulling my hair out over this all day, I'm thinking maybe there's a permissions problem that is not allowing usbmount to execute the python script, but if there is I can't figure it out.

Clarification: I have a shell script in /etc/usbmount/mount.d that logs when it is called and then calls my python script.

  • 1
    If possible, post the bash script that you've referenced, as well as Python script. If the issue with the syntax, we can't know without seeing the code. I've never heard about run-parts. Is there a reason you're not using udev subsystem for running the script ? – Sergiy Kolodyazhnyy Dec 15 '18 at 0:35
  • The usbmount documentation uses /etc/usbmount/mount.d as a location for hook scripts and provides environmental variables to scripts it executes in that folder. github.com/rbrito/usbmount#hook-scripts My shell script is really really simple: #!/bin/sh logger "Ingest Script run, Mountpoint: $UM_MOUNTPOINT" python3 /home/user/scripts/ingestion/ingest.py "$UM_MOUNTPOINT" & – Joe Potchen Dec 15 '18 at 0:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.