I'm working on a DIY NAS project running on Ubuntu 18.04.

I want to implement the following feature: when an external USB disk is connected (could be a specific disk identified by UUID or PARTITIONUUID or partition volume label, but I could live with 'any disk'), even if no user is logged on, a (backup) script is launched.

I've tried various approaches found on the 'net, but none of them works:

  • I can't seem to disable the built-in automount, which is required for me to test that my script would run upon disk connection even if no user is logged on -- currently I have:
    • the following entry in /etc/fstab: PARTUUID=de0528be-7fd9-46f6-b74e-aad68cae11c2 /databackup ext4 defaults,nofail 0 0
    • 'gsettings get org.gnome.desktop.media-handling automount' returns 'false'

Is the fstab entry causing the automounting? If so, why is that, and I expect this would happen even with no user logged on; how would I then fire the script after the mount has been completed?

  • running mount from a script forked by a script launched by a udev rule doesn't work

What am I missing / getting wrong?

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.