27.6. nfsdown

If you have nfs on your system you might find this script handy. I look after several machines and periodically I may have to reboot one of them during normal working hours. This usually has to be done as quickly as possible.

As I have remote directories mounted all over the place, I do not want to have to rely on the rebooting process to take care of the nfs unmounting. I would rather do it myself; besides it’s faster than letting the machine do it.

I just run the script (which is on all the machines) and all the nfs mounts get unmounted, allowing me to do a faster reboot.

The script holds a list of machines that I have nfs mounts on. A for loop loops around this list, doing a grep of each host through the df command. The nfs ...

Get Linux and Unix Shell Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.