Linux scripting - how do I wait for CD/DVD medium to load before reading/mounting?

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I'm putting together a quick-and-dirty script to help me 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 -texits as soon as the tray closesmountwill fail with No medium found if it's run immediately aftereject, 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.
bash shell optical-media
add a comment |Â
up vote
0
down vote
favorite
I'm putting together a quick-and-dirty script to help me 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 -texits as soon as the tray closesmountwill fail with No medium found if it's run immediately aftereject, 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.
bash shell optical-media
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm putting together a quick-and-dirty script to help me 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 -texits as soon as the tray closesmountwill fail with No medium found if it's run immediately aftereject, 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.
bash shell optical-media
I'm putting together a quick-and-dirty script to help me 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 -texits as soon as the tray closesmountwill fail with No medium found if it's run immediately aftereject, 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.
bash shell optical-media
bash shell optical-media
asked 1 min ago
myxal
286
286
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f477577%2flinux-scripting-how-do-i-wait-for-cd-dvd-medium-to-load-before-reading-mountin%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password