Re: Detecting if /Network/Library is available
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 > On Sep 3, 2018, at 14:51, Sandor Szatmari > wrote: > > Thanks for your thoughts! > > Below vvv >> On Sep 3, 2018, at 13:14, Jean-Daniel wrote: >> >> >> >>> Le 3 sept. 2018 à 19:07, Sandor Szatmari a >>> écrit : >>> >>> 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? >> >> 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-dev@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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detecting if /Network/Library is available
Thanks for your thoughts! Below vvv > On Sep 3, 2018, at 13:14, Jean-Daniel wrote: > > > >> Le 3 sept. 2018 à 19:07, Sandor Szatmari a >> écrit : >> >> 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? > > 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-dev@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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detecting if /Network/Library is available
> Le 3 sept. 2018 à 19:07, Sandor Szatmari a > écrit : > > 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? 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-dev@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/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Detecting if /Network/Library is available
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-dev@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/archive%40mail-archive.com This email sent to arch...@mail-archive.com