start script if specific usbdevice gets plugged in

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Husse

Re: start script if specific usbdevice gets plugged in

Post by Husse »

This is a bit tricky
When you plug in a pen drive the number of items in /dev increases - actually by 6 for a one partition drive
I don't know which files, so I don't know if you see UUID in any
/etc/mtab is also changed - but it's not using UUID
/media is changed - again no UUID
I would suspect something happens in /proc as well
and of course there is dmesg, but no UUID there either
Time to google - but for what? Can't think of a useful search phrase...
So in essence - I could tell you how to start a script if something was plugged in into USB, but not if it is to be a specific device
Looking at dmesg I see that the size is mentioned, that might be used - trigger an event if a drive of a particular size is plugged in
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Husse

Re: start script if specific usbdevice gets plugged in

Post by Husse »

a script if something was plugged in
but not necessarily in USB, but what else could it be.
Watch mtab - if mtab changes something is plugged in - or out
File size is probably the simplest - I haven't tried it so I'll have to leave the details to you
Locked

Return to “Beginner Questions”