What more could you want?
Posts tagged bash
Lazy Umounting
Jun 11th
I came across a mounted sdb1 partition, but the physical device didn’t exist. This was on a Red Hat EL 5 box.
No files in the mount point, obviously, no users logged in but me, and I wasn’t standing in the directory. Even lsof couldn’t show me anything about that directory, and I almost cried when fuser -km reported nothing killed.
Umount gave this error:
# umount /dev/sdb1 umount: /dev/sdb1: device is busy umount: /dev/sdb1: device is busy
In the man page, I found the -l option for umount. The Lazy unmount. It says this:
Detach the filesystem from the filesystem hierarchy now, and cleanup all references to the filesystem as soon as it is not busy anymore.
Sounds good to me, and it worked, too. Just watch out for data loss.
/cs
Adding Arguments to your Scripts
Feb 5th
I like bash.
It is simple and straight forward. In the words of Master Foo, “Is it he who writes the ten thousand lines, or he who, perceiving the emptiness of the task, gains merit by not coding?”
One of the easiest things to do in a bash script that has more than one function is to add the capability of the script to allow arguments to specify it’s action.