Discussion:
Detecting if /Network/Library is available
(too old to reply)
Sandor Szatmari
2018-09-03 17:07:11 UTC
Permalink
I have a problem to solve where it appears I need to detect if /Network/Library is available or not.

Basically, I’d like to handle situation where I need to copy items from /Network/Library at times when it’s it’s not yet available but may be available soon… i.e. at boot, or after the Network cycles, etc.

There’s a couple of strategies I can think of:

Keep failing the copy until it works or a default time out expires
Notification of availability (Preferred, but I can’t find a way to do this)
Quit and retry later.

Any suggestion/guidance anyone can provide on this?

Thanks in advance,
Sandor
_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.ne
Jean-Daniel
2018-09-03 17:14:13 UTC
Permalink
Post by Sandor Szatmari
I have a problem to solve where it appears I need to detect if /Network/Library is available or not.
Basically, I’d like to handle situation where I need to copy items from /Network/Library at times when it’s it’s not yet available but may be available soon… i.e. at boot, or after the Network cycles, etc.
Keep failing the copy until it works or a default time out expires
Notification of availability (Preferred, but I can’t find a way to do this)
Quit and retry later.
Any suggestion/guidance anyone can provide on this?
I’m not familiar with /Network/Library, but if this is a standard directory, you can wait for it to be created using file system event (I think there is a node dispatch source for that), and if this is a mount point, you can use disk arbitration framework to get notification.

_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.na
Sandor Szatmari
2018-09-03 18:51:41 UTC
Permalink
Thanks for your thoughts!

Below vvv
Post by Jean-Daniel
Post by Sandor Szatmari
I have a problem to solve where it appears I need to detect if /Network/Library is available or not.
Basically, I’d like to handle situation where I need to copy items from /Network/Library at times when it’s it’s not yet available but may be available soon… i.e. at boot, or after the Network cycles, etc.
Keep failing the copy until it works or a default time out expires
Notification of availability (Preferred, but I can’t find a way to do this)
Quit and retry later.
Any suggestion/guidance anyone can provide on this?
I’m not familiar with /Network/Library, but if this is a standard directory, you can wait for it to be created using file system event (I think there is a node dispatch source for that), and if this is a mount point, you can use disk arbitration framework to get notification.
/Network/Library is a special directory published by OSX server that allows you to share a common ‘Library’ folder to the clients on your LAN. As an example of its special behavior, it appears as a directory even when not available. (It probably is a directory itself). It is created once and does not go away, like /Volumes. I am trying to detect the presence of files within it or whether it’ is ‘mounted’. When it’s not available ‘ls -al’ responds with ‘ls: Host not available’. And when it is available ‘ls -al’ responds with directory contents as expected. I can use this behavior to implement the keep trying while failure and not timed out approach.

I have looked at FSEvents and Disk arbitration already and I’m not sure I can use these as it does seem to have special treatment. I hope I can use one of them. I tried NSWorkspace (disk mount/in mount notifications) and these didn’t seem to be triggered.

Sandor
_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to
Sandor Szatmari
2018-09-04 12:54:09 UTC
Permalink
OK inertia overcome… I tested FSEvents and if I create an event stream for /Network and restrict to mount and I unmount flags I can successfully detect the mounting and in mounting of these shares. I appreciate your thoughts! Thanks for your help.

Sandor
Post by Sandor Szatmari
Thanks for your thoughts!
Below vvv
Post by Jean-Daniel
Post by Sandor Szatmari
I have a problem to solve where it appears I need to detect if /Network/Library is available or not.
Basically, I’d like to handle situation where I need to copy items from /Network/Library at times when it’s it’s not yet available but may be available soon… i.e. at boot, or after the Network cycles, etc.
Keep failing the copy until it works or a default time out expires
Notification of availability (Preferred, but I can’t find a way to do this)
Quit and retry later.
Any suggestion/guidance anyone can provide on this?
I’m not familiar with /Network/Library, but if this is a standard directory, you can wait for it to be created using file system event (I think there is a node dispatch source for that), and if this is a mount point, you can use disk arbitration framework to get notification.
/Network/Library is a special directory published by OSX server that allows you to share a common ‘Library’ folder to the clients on your LAN. As an example of its special behavior, it appears as a directory even when not available. (It probably is a directory itself). It is created once and does not go away, like /Volumes. I am trying to detect the presence of files within it or whether it’ is ‘mounted’. When it’s not available ‘ls -al’ responds with ‘ls: Host not available’. And when it is available ‘ls -al’ responds with directory contents as expected. I can use this behavior to implement the keep trying while failure and not timed out approach.
I have looked at FSEvents and Disk arbitration already and I’m not sure I can use these as it does seem to have special treatment. I hope I can use one of them. I tried NSWorkspace (disk mount/in mount notifications) and these didn’t seem to be triggered.
Sandor
_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.

Loading...