(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Home > Mac OS X Articles > wait4path
Printer Friendly Version



wait4path

May 2006



This is one of those odd commands that somehow make their way into standard distributions. Its obvious intent is to wait for some file system to mount: it just sleeps and doesn't return until it is. You can't really use it for ordinary directory watching (see Monitoring file or directory changes if you need that) because it only checks when the mount table is updated. So you can do "wait4path /not_here_yet" and it will sleep, but it won't wake up and return just because you "mkdir /not_here_yet". If you subsequently mount or unmount any file system, it will wake up and notice /not_here_yet, but not until then.

Therefor its obvious use is in a startup script that needs to hang on until some specific filesystem is mounted. Is it actually used in OS X? Well, not on my MacBook, but there's nothing being mounted there it would need to wait for. If I had a server here, and user's directories were there, maybe it would make use of this.

You could use this as a cheap notification of mount/unmount events:


#/bin/bash
rm -rf /tmp/foobah
while :
do
# not foolproof
bash -c "sleep 1;mkdir /tmp/foobah" &
wait4path /tmp/foobah
rm -rf /tmp/foobah
mount
echo "Something changed"
done

Though at the moment I can't think of a good reason that would make you want to.
Technorati tags:




Click here to add your comments





Tue May 8 06:25:37 2007:   anonymous




Try mount -u <an already mounted mount-point>, e.g.


Process 1:
wait4path /tmp/foo

Process 2:
mkdir /tmp/foo

mount -u /



The only side effect I'm aware of is that you get a seemingly innocuous syslog entry like the following:


Mmm dd hh:mm:ss host KernelEventAgent[PID]: tid 00000000 received unknown event (256)



Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar

cartoon


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.


book graphic unix and linux troubleshooting guide

My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!



 I sell and support
 Kerio Mail server





pavatar.jpg
More:
       - MacOSX


Unix/Linux Consultants

Skills Tests

Guest Post Here













My Favorites

Change Congress