Linux scripting - how do I wait for CD/DVD medium to load before reading/mounting?
2
votes
2
answers
2132
views
I'm putting together a quick-and-dirty script to read 100s of CD/DVDs onto a NAS. It takes care of ejecting and loading the tray, but I haven't figured out a simple way to wait/block for the medium to become available to the OS after inserting the tray.
-
eject -t
exits as soon as the tray closes
- mount
will fail with *No medium found* if it's run immediately after eject
, but also when it's run 15 seconds later.
The discs are fairly old and some take considerable time to become available, so I'd like to avoid the "sleep for 2 minutes" non-solution. Any ideas? Using ubuntu 18.04.
Asked by myxal
(175 rep)
Oct 24, 2018, 05:51 PM
Last activity: Nov 7, 2018, 12:33 AM
Last activity: Nov 7, 2018, 12:33 AM