Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a laptop and NAS. What I want to do is to mount my NAS only when my wireless is connected, and umount it at wireless disconnected.

I have written both scripts I wat to run- they check the name of the connection and connect or disconnect. I have added the connect and disconnect scripts to to /etc/network/if-up.d and /etc/network/if-down.d.

The script which starts at if-up works correctly, the other one not- it will simply not umount. I thing the script executes when the wireless is already disconnected.

I want a way to run the script pre-disconnecting the wireless.

I used to do this with wicd in Kubuntu 11.04, but it seems too buggy now.

share|improve this question

1 Answer 1

Of course you understand that your system can't figure out when will a wireless connection drop unless you press a button that tells it.

From what I have seen you just want to get rid of the mount when the network goes down, for that you can use

umount -l /mnt/folder

Its considered dangerous by many since it will unmount a file system that might still be in use but since your network is already down I don't see much of a problem.

share|improve this answer
    
I try to run umount -l /media/MyBookLive Unfortunately, the command will not work as expected - the system will still hang waiting for the NAS to respond... I will have to swallow wicd bugs probably –  deckoff Oct 24 '11 at 15:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.