David Garamond <lists / zara.6.isreserved.com> writes:

> Example: I need to unmount /usr and /usr2, but currently I can't
> because there are some opened files from those partitions. I am going
> to try shutting down daemons or killing some processes (or other
> things), one at a time, until I can unmount it.
>
> [...]
> 
> But still it's not pretty enough. Any more elegant way?

This is how I'd do it.

| solutions = [
|   proc do
|     system "/etc/init.d/httpd stop"
|     system "/etc/init.d/squit stop"
|   end, proc do
|     kill("rdiff-backup", :TERM)
|     sleep 3
|   end, proc do
|     kill("rdiff-backup", :KILL)
|     sleep 3
|   end
| ]
| 
| until unmount("/usr") && unmount("/usr2")
|   solutions.shift.call
| end

Sorry about the eccentric formatting.  For some reason, putting the
`end' and the `proc do' on different lines gives me the hibbie-jibbies.

--
Mikael Brockman