Help me on how to umount partition when its opened on another shell...
Hello All
I've a LUKS parition on /dev/sda3. I don't want to mount this partition on boot, so I've written this script to mount and umount as and when its required. I've put this script in /etc/bash.bashrc Any time I want to open this partition, I type 'yama 1'. To close I type 'yama 0'. I've also ensured, while umounting partition, if I'm in the same partition (directory), I'll be moved to home directory - and then it will be umounted. But this works fine when I'm on the same shell. While I'm on the partition in one tab, and if I open a new tab, and there I type 'yama 0', then I get error and partition will not be umounted. How do I ensure, no matter where i issue command, the partition will be umounted successfully. This is my script Code:
function yama() { Code:
[abc@xyz ~]$ yama 1 Tab 1: Code:
[abc@xyz ~]$ yama 1 Code:
[abc@xyz ~]$ yama 0 How do i solve this? Thanks |
You might be able to script lsof or fuser to get the terminal ID of the one sitting in the directory, and then use one of the suggestions here to send it a cd command to move out:
http://unix.stackexchange.com/questi...ctive-terminal Or skip the cd and just kill the session that's in the wrong spot. |
Have you tried lazy umount?
|
Thank you very much.
@suicidaleggroll, I tried ttyecho, but it doesn't work on my pc (arch linux). Didn't try selector - it looks too complicated. Anyway thanks. @Emerson, It worked wonderfully. Thanks. |
All times are GMT -5. The time now is 10:31 AM. |