Prevent unmount

I have script which analyzes files in external drive. Analyzing takes long time and this script is running in background all the time but its also idling alot.

Sometimes i accidentally eject that external drive manually and then my script do weird things.

How i can prevent drive unmounting?

One way would be create dummy text file to external drive and keep it open.

Are there any better ways to do this? Thanks

You could set its visible to false so you wouldn’t see it, then set it to true again when your script finished.

Thanks. Thats interesting idea. Any other way to do it?

I have few other scripts which might unmount external drives too and setting invisible won’t help.