Unmount network share at sleep

I would like to disconnect from my networkshare (unmount airdisk) when I put the Mac to sleep. Is there some setting or tool to do this automatically?
Thanks

I was waiting hoping for somebody else to answer, for as far as I know, this is a drawback that Macs have had for a long time!
What I'd do myself I think, is make a Script in Automator, that unmounts the Share THEN puts Mac to sleep, rather than just trying to sleep it.
It's not an Automount Share is it?
Sorry, on Panther right now & no Airdisk to experiment with.

Similar Messages

  • Network shares get unmounted after wake up

    Hi all,
    I have all my music in a network shared drive (AFP share), and in Lion, once mounted from Finder, it would stay like that even if the iMac went to sleep.
    With Mountain Lion, it seems that when the Mac goes to sleep, all mounted shares get unmounted when the system wakes up, which is very unconvenient with Apple TV.
    Is there any way to return to the old behaviour? Is this a bug? Or a new feature?
    Thanks
    Christian

    Strange thing is that the network share is not actually unmounted. Listing the volumes in terminal (ls /Volumes) shows my 'Media' SMB share (displayed as 'Media-1', don't know why, and that is probably a part of the problem) and I can browse it or whatever. iTunes also works fine. The share simply disappears from the desktop after a longer period of time.
    Once I reconnect to my share through the Finder, ls /Volumes shows both the 'Media' and the 'Media-1' share, which is actually one and the  same SMB share listed under two different entries.
    Also, when the share disappears from the desktop, all the paths of the files in iTunes change to  'Media-1', but upon reconnecting the share and relaunching iTunes, everything gets back to normal and the paths lead correctly to the 'Media' share.
    Weird.

  • Problems with mount and unmount of network shares

    Hi,
    I use an Apple script to mount four network shares during startup of an OS 10.4.4 Powerbook. Unfortunately it seems that Tiger can't always mount them all. Sometimes it only mounts three of them, but pressing Command + K indicates that the fourth is already mounted because it's grayed out. How come I can't see it on neither the desktop nor the favorites list in a Finder window then?
    I have a Tiger installation at home with Ciscos VPN Client 4.8 installed. I use that VPN client to gain access to the company's network. When the connection is established, I mount a share (with AFP over TCP/IP) on the company's server running Win2003 and ExtremeZ-IP.
    When I close down Ciscos VPN Client, the mounted network share doesn't unmount automatically, and if I forget to toss that network drive in the trash before closing down or restarting my Mac, it hangs. Why can't it just unmount that drive automatically when the VPN connection is gone?
    Regards
    Thomas G. Madsen
    Powermac G5 (2 x 1.8 Ghz)   Mac OS X (10.4.4)  

    This may happens because broadcasts do not go through an IPSec tunnel.
    Browsing Network Neighborhood is a function of the Microsoft browsing service. Any problems are usually because the PC or master browsers do not function properly. Network Neighborhood is officially not supported. However, it works if configured correctly. Browsing Network Neighborhood works by obtaining the browse list from either a master or backup browser. This list is obtained locally on your LAN by using NetBIOS Broadcasts to locate domain browsers.
    Inorder to resove this :
    Make sure you have NetBIOS over TCP enabled on the adapter that you use to connect to the domain.
    Refer this related links:
    http://www.cisco.com/en/US/products/sw/secursw/ps2308/products_tech_note09186a0080194b4a.shtml

  • After waking from sleep, I lose all my network shares

    On my MBA with 10.7.1, after I wake it from sleep and after my wireless kicks back in, I lose all my network shares and the only way to get the back is to turn wireless off then back on.  Once I do this I can select my other computer on the network and everything pops back up instantly.
    I've tried this same scenario many times and each time the exact same thing happens.  I wake it.  Network comes back up and I can access the Net.  I see my network shares disappear.  I select the computer I'm trying to get to and it fails.  I turn wireless off/on.  I select the computer again and it connects instantly.
    I've never seen this behavior before and certainly not with 10.6.x running everywhere.  Now I have 10.7.1 on my MBA, wifes MBA, and my iMac (which is computer I try to connect to).  This same behavior happens on my wifes MBA as well.
    Any ideas?  I'm going to update to 10.7.2 and see if that does anything.  Hopefully it doesn't break something else!
    Anthony

    And 10.7.2 didn't fix whatever the problem is.  Weird...

  • Network stops before network shares are unmounted (fstab)

    Hi,
    I use fstab to set up my network shares. In my rc.conf I have "network" then "netfs". When shutting down, the network is stopped before the shares are unmounted so the system never shuts down; it just hangs trying to unmount them.
    Is there another/better way to specify network shares or a fix for this issue?
    Thanks

    Hi,
    I think my solution is better for mobile computers that are not always connecting to the same network: using networkmanager you can make a 'dispatcher'-script that only loads after connecting to a specified network. There are examples on the wiki.
    This way, my laptop is not trying to connect to my home NFS-shares when I connect to my parents' network, which could be a security risk.

  • [SOLVED]Unmounting NFS shares before network is brought down

    I'm using networkd and I have enabled the network-wait-online service, so at boot-time my NFS shares are mounted after the network becomes available. That all works perfectly.
    However, it doesn't work the other way around i.e. when shutting down. The network is brought down, and then systemd attempts to unmount the shares, which obviously doesn't work.
    Have I missed a step?
    Last edited by tomk (2014-07-04 12:31:47)

    Strike0 wrote:I'm not using it, but reading your topic made me associate the "nfs-client.target" mentioned here: https://mailman.archlinux.org/pipermail … 26393.html
    I checked this out too, but it has a lot of 'Wants' that I don't really need.  Maybe I could fix it up, but I use autofs so I don't have this problem (the real autofs, not the systemd one).
    % systemctl cat nfs-client.target
    # /usr/lib/systemd/system/nfs-client.target
    [Unit]
    Description=NFS client services
    Before=remote-fs-pre.target
    Wants=remote-fs-pre.target
    # Note: we don't "Wants=rpc-statd.service" as "mount.nfs" will arrange to
    # start that on demand if needed.
    Wants=rpc-gssd.service rpc-svcgssd.service
    Wants=nfs-blkmap.service rpc-statd-notify.service
    Before=rpc-gssd.service rpc-svcgssd.service nfs-blkmap.service
    [Install]
    WantedBy=multi-user.target
    WantedBy=remote-fs.target
    Last edited by WonderWoofy (2014-06-21 01:00:04)

  • Network Shares Disappear on Wake From Sleep

    I recently got a Mac mini to replace an aging Mac Pro. I copied all my data over and everything is running great, and much faster overall. But I'm having one strange bug. When I put my Mac mini to sleep, it wakes up and all of my network shares are gone. I have 4 shares I keep connected all the time, and many more I use occasionally. All of these servers are Macs. I never had an issue like this on the Mac Pro, in all it's years of service. Including the time it was running 10.8. But now, the mini dumps shares - I think every time it goes to sleep, if not, almost every time. It's a real hassle having to reconnect to each share every time you wake up. Plus it's no fun having open documents dissapear either. My network settings are pretty simple, my primary connection is gigabit ethernet. It's first in the "service order" list. I also have airport enabled but not connected. I leave it on so my computer can have location serivces. This is all exactly the same as the setup in the old Mac Pro.
    Any ideas?

    If you must put your computer to sleep, you could use an applescript to re-mount your network shares when you wake it up.
    tell application "Finder"
              mount volume "afp://servername.local/sharename" as user name aUsername with password aPassword
    end tell

  • [SOLVED] advanced shell script for mount and unmount samba share

    Good morning guys,
    Today I've a very long question....
    Hope in your help....:
    I usually move from different network.
    For one of those I need to mount some share that are under an ActiveDirectory server.
    To do that I use samba.
    Especially I've made and use the below  shell script.
    I know that it's so stupid but I'm a very newbie:
    #!/bin/sh
    echo "This is a custom script for mount my citrix share"
    echo "Please insert user password (must a sudoer user)"
    echo " "
    sudo mount -t cifs -o username='myusername',password='mypassword' //host_ip/TsHome$/myusername /home/myuser/samba_share/TsHOME
    sudo mount -t cifs -o username='myusername',password='mypassword' "//host_ip/direction" /home/myuser/samba_share/direction
    echo " "
    read -p "Press ENTER key to close this terminal"
    exit
    As I say the script work but it's so crude...!
    I want/need to implement it whit the follow addictions:
    1. print a feedback on mount: somenthing like "TsHOME is now mounted" or "unable to mount TsHOME"
    2. check if the share are already mounted: to prevent accidentally multiple mount. If a share is already mounted I want to print something like "TsHOME is already mounted on /home/myuser/samba_share/TsHOME"
    3. ask for share password  (now it's in clear on script) - This is optinal
    4. un-mount the share before reboot or shutdown command. That because I've notice that If i reboot or shutdown without manually un-mount the share the step of unmounting network file system became very slow
    If it's no extremely difficult, can someone help me to write this script?
    I know that man exist but I'm not a programmer and it's so difficult for me approch it.
    Thank you in advance.
    Ale
    Last edited by Alexbit (2010-09-23 21:29:13)

    Thank you very (VERY) much!
    I've follow your information and.. it work!
    If can be usefull to other this is the complete script:
    #!/bin/sh
    echo "This is a custom script for mount citrix share"
    echo "****************************************"
    echo " "
    echo "Please insert domain password:"
    read -s mypassword
    echo " "
    echo "|checking mount state...in share are not mounted mount it!|"
    echo "+-------------------------------------------------------------------------+"
    if grep "TsHome" /etc/mtab &>/dev/null; then
    grep "TsHome" /etc/mtab | awk '{print "TsHome is already mounted on " $2}'
    else
    sudo mount -t cifs -o username='yourusername',password="$mypassword" //ipaddress/TsHome$ /home/Samba_share/TsHOME && echo "TsHOME is now mounted" || echo "unable to mount TsHOME"
    fi
    echo " "
    if grep "direction" /etc/mtab &>/dev/null; then
    grep "direction" /etc/mtab | awk '{print "direction is already mounted on " $2}'
    else
    sudo mount -t cifs -o username='yourusername',password="$mypassword" '//ipaddress/direction' /home/Samba_share/direction' && echo "direction pat is now mounted" || echo "unable to mount direction"
    fi
    echo " "
    if grep "Area" /etc/mtab &>/dev/null; then
    grep "Area" /etc/mtab | awk '{print "Area is already mounted on " $2}'
    else
    sudo mount -t cifs -o username='yourusername',password="$mypassword" '//ipaddress/Area' /home/Samba_share/Area && echo "Area is now mounted" || echo "unable to mount Area"
    fi
    echo " "
    echo "All DONE!"
    echo " "
    read -p "Press ENTER key to close this terminal"
    exit
    I don't really well understand what I've to put in rc.local.shutdown....
    I think somethings like:
    #!/bin/bash
    # /etc/rc.local.shutdown: Local shutdown script.
    echo "This is a custom script for UN-mount citrix share"
    echo "********************************************"
    echo " "
    echo "|check mount state: if mount then un-mount!|"
    echo "+-------------------------------------------------------+"
    echo " "
    if grep "TsHome" /etc/mtab &>/dev/null; then
    grep "TsHome" /etc/mtab | awk '{print "TsHome is NOT mounted -> going on..." $2}'
    else
    sudo umount /home/Samba_share/TsHOME && echo "TsHOME is now UN mounted" || echo "unable to UN-mount TsHOME"
    fi
    echo " "
    if grep "direction" /etc/mtab &>/dev/null; then
    grep "direction" /etc/mtab | awk '{print "direction is NOT mounted -> going on.." $2}'
    else
    sudo umount /home/Samba_share/direction && echo "direction is now UN mounted" || echo "unable to UN-mount direction pat"
    fi
    echo " "
    if grep "Area" /etc/mtab &>/dev/null; then
    grep "Area" /etc/mtab | awk '{print "Area is NOT mounted - Finished" $2}'
    else
    sudo umount /home/Samba_share/Area && echo "Area is now UN mounted" || echo "unable to UN-mount Area"
    fi
    echo " "
    echo "going shutdown"
    echo " "
    sleep 5
    I've try but it seems to ignore the IF statement... this is the output when ALL share are UNmounted:
    $ sh /etc/rc.local.shutdown
    This is a custom script for UN-mount citrix share
    |check mount state: if mount then un-mount!|
    +-------------------------------------------------------+
    umount: /home/Samba_share/TsHOME: not mounted
    unable to UN-mount TsHOME
    umount: /home/Samba_share/direction: not mounted
    unable to UN-mount direction
    umount: /home/Samba_share/Area: not mounted
    unable to UN-mount Area
    going shutdown
    Tomorrow I will test again when I'm at office.
    Meanwhile can you check if I made a macroscopic mistakes?
    Thank you again!
    Last edited by Alexbit (2010-09-23 17:34:49)

  • Network shares can't be ejected? ("Ghost" share problems)

    This topic is to try to solve a problem I'm having, as well as many of my Mac friends, when they use a network share, and it then cannot be unmounted.
    Basically, there are servers no longer accessible, because we switched LANs, etc.
    Symptoms: in the Finder, clicking on the "Eject" button next to the computer's name gives out a dialog telling "A disk on <share name> is in use. Try close applications. (approximately).
    Of course, closing all applications doesn't have any effect, neither does relaunching the Finder.
    In the Terminal, the command "mount" displays, among others:
    //GUEST:@ines:139/Shared Docs em Vaio1 on /Volumes/Shared Docs em Vaio1 (smbfs, nodev, nosuid, mounted by xxx)
    //GUEST@ines:139/Download on /Volumes/Download (smbfs, nodev, nosuid, mounted by xxx)
    I tried umount "Shared Docs em Vaio1", as well as the other share, and yet it outputs "not currently mounted"
    I then did lsof to check what files were open on these share, and the output starts with lsof: WARNING: can't stat() smbfs file system /Volumes/Shared Docs em Vaio1
    Output information may be incomplete.
    assuming "dev=2d000004" from mount table
    lsof: WARNING: can't stat() smbfs file system /Volumes/Download
    Output information may be incomplete.
    assuming "dev=2d000005" from mount table
    I've reached the end of my meager knowledge on this issue, which is minor (in the sense that performance is not affected), but relatively present nevertheless.
    Of course it goes off when rebooting, but I want to be able to solve this problem without a reboot, so how can it be?

    I don't know if it is the same with SMB shares, but with AFP ones I sometimes get this message when the share point is on my MacBook & it goes to sleep. The 'solution' -- such as it is -- is just to wait for the client Mac to notice the server isn't responding & pop up a server disconnect notice on the screen. Once you click the 'ok' button in that notice, the share point disappears from the Finder & no more messages about something on it being in use appear.
    This notice can take several minutes to appear. I don't know of any way to speed up the process, or if it would be wise to try. I assume the long timeout is so that brief network outages are not problematic.

  • How can I stop an network share from auto mounting?

    I have a recent 13" MBPr and I installed Steam.  For kicks, I told it to save the library on my 10.8 mac mini server.  This worked well.  It worked so well, I started up Parallels and did the same thing for my steam library on my boot camp partition. I closed Parallels and Steam then put my laptop to sleep.  I was away from my home network and repeatedly received messages about not being able to access my server in a standard Finder pop-up.  No big deal, I opened Steam to try and remove the library from my list.  It was no longer listed.
    Upon arriving home I opened steam and still could not find my share in the list.  I removed Steam and all it's support files.  Still on every boot I get the finder error about not being able to connect to my server.  When I boot up my parallels boot camp VM I get the same Finder error.  It pops up several (I never bothered to count) before it stops after I keep closing the pop-up.
    I've looked at /etc/auto_master and /etc/auto_home, my login items, and I cannot find the process that keeps trying to mount the network share.  When I am at my home and reboot my mac or boot parallels I do not receive the error.  But I also do not see the mounted share on my desktop.  I do see it when I perform the ls command on /Volumes.  When I try and cd into it I get a Permission Denied error.  Root/Wheel seems to own the mounted share.  When I sudo the folder I see all the files stored on that volume.
    Does anyone know how I can stop this from happening without resorting to creating a new user?  I just got this one the way I like it (before I screwed it up with steam!)
    Thanks for reading my short novel.

    did the restore through itunes but to no avail.
    Then you must have restored and installed your backup when requested.  To remove those emails, you have to restore as new, i.e. without your backup, as roaminggnome suggested.

  • Social networking share widgets for iWeb... any solutions?

    I've been trying in vain for sometime to get one of the social networking share widgets (ShareThis, AddThis, TellaFriend) to work in iWeb 08 and am hoping someone might be able to help.
    With all i am pasting the code provided by these services into the HTML Snippet box. I am using the popup functions, since without doing so requires the HTML Snippet box to be resized unacceptably large obscuring other links on the page. The widgets are published fine, however the link they provide when posting to social networking site or included in an email add an additional extension on the URL that just links to an image of the widget. (i.e. http://web.me.com/fknott/CrystalCove_Properties_2//Home_files/widget1markup.html) the URL should end Home.html.
    Does anyone know how to fix this? the tech folks at each of these sites have been no help at all. Are there any other share widgets aside from these that will work seemlessly with iWeb?
    I really appreciate any help.
    Thank you,
    Troy

    Hello Marc,
    The code generated by ShareThis will not work with iWeb/insert HTML snippet.
    You'll have to put it inside the body tags of every HTML page at the location where you want it to show.
    Attention : the code is inserted after publishing = outside iWeb ! Every time you change a page in iWeb and publish it, you'll need to enter the code again.
    To automate this process you can use [TextWrangler|http://www.barebones.com/products/TextWrangler>
    _ in iWeb on every page you want ShareThis, create a new textbox and add something that is unique and easy to find afterwards when the page is published as a HTML page : ex. AAAAAA,
    _ move the textbox to the location where you want it to show, resize if needed,
    _ publish your website with iWeb,
    _ mount your iDisk in the Finder,
    _ open TextWrangler and the first thing you do is "start recording",
    _ open the first HTML file you see in your Site, ex. index.html (It's OK if that page doesn't have the AAAAAA) +(when you have the ShareThis on a specific Site or Blog only, locate that folder),
    _ in the Search field enter AAAAAA,
    _ in the Replace fiel enter the code provided by ShareThis,
    _ do a "replace in all files in this folder" where you select your Site or Blog folder,
    _ stop recording and save the script for later,
    _ unmount iDisk from the finder.
    Done.
    On my Blog entry about [Favicons|http://www.site49.eu/Leo/Tips4Mac/Entries/2009/2/15_Favicons.html|Add favicons to iWeb websites] you can find some screenshots on how to use TextWrangler as an automated search and mass replace tool.
    Kind regards,
    Leo

  • Network shares in Windows 7: What am I doing wrong?

    I bought the extreme 6th gen and it's working rather well however I'm running into issues trying to map network share in windows.
    I have a Seagate Slim 500gb bus powered external drive hooked up to the USB port on the back of extreme. There are 2 partitions both formatted for hfs, one for time machine and one for copying files.
    While in mountain lion, the share works fine. I've run time machine several times and it seems all is good. However under windows it's a different story. I will map a share, I.e. \\devicename\partitionname and then it will prompt for login details. I have a device password setup, so it's the name I gave the APE and the password. However I will almost always get an error saying that "x: refers to a location that is no longer available" error.
    However, if I update the APE then the network share operates fine after it restarts. Also, if I unplug the drive then plug it back in after getting the error that seems to fix it as well,
    Under osx there are no issues, so I don't know why this is happening under windows only, either my desktop or laptop. Login and workgroup credentials are correct.
    So is this a drive issue? Does the APE not like bus powered USB drives? Perhaps my Seagate slim is going to sleep and won't wake up unless I restart the APE. Can this be confirmed because I'm having a heck of time looking up this issue anywhere else, but surely I can be the only one running into this. Thanks.

    I am not sure what the last post means..
    If the drive sleeps and cannot be woken up by the request for files, it is unsuitable.
    Replace with another drive. .not a self powered one.
    Or you can try a powered hub  to unload the power problem from the AE.. they have never been great with USB drives that are self powered. Although the gen6 should have more than adequate power available.

  • Network Media Player (Noontec V9-T) unable to access network shares on WIN8 Pro

    I have just upgraded from Windows 7 home premium 64 bit to Windows 8 Pro 64 bit. After the upgrade, I made sure my video library was shared (both with the homegroup and my username) and that network discovery was enabled file sharing enabled etc etc.
    On the Noontec Media centre I can see the workgoup called WORKGROUP. When I click on it I can see the name of my PC. But when I click on the pc name to log in to access the shares within it comes up with a username/pass box comes up. I then put in my username/pass
    on the windows 8 pro machine, to which the Noontec receives an error message stating cannot login.
    Previously I had enabled sharing with everyone (read only) on windows 7 home and this username/pass dialog box never appeared. Just said successful logon. So i tried sharing video library with "everyone" in windows 8 pro, the unit still can't log on.
    I believe this noontec uses Samba. The last updated samba file was named "samba_3.0.23c_mipsel.ipk" when I updated the media players samba about 9 months-a year ago. i have checked the manufacturers website, there has been no further updates released.
    Is there a way for me to access network shares from this media centre by maybe installing a new samba server on the windows 8 machine that is compatible with older samba clients? I am not savy with samba clients/servers at all, I just loved the way XP network
    shares always seemed to work across multiple platforms... and win7/8 doesn't. Help anyone?

    A lot of these media players will not work correctly. If your Video files are stored as .avi, MKV, MP4 etc.. pretty much anything excpet for .ISO, the best way is to use Plex media server on the windows 8 PC. It's free and should allow you to organise files
    and libraries as you want.In fact, it's my preferred access method now, as most, smart TVs also support plex and support it well....allowing me to play the files directly in my smart TV, without using the Media players.
    In addition if you have an Android tablet or phone, you can (if you want) access your media files from Plex using Media Monkey (free) and simply play them direct to the TV, Media Monkey simply hands the data stream over to the smart TV.
    I have a similar set of media players and exactly the same problem with windows 8,8.1, previous shares on versions 7, vist etc..work perfectly. I use a free application on my android phone to remote start my media server/s (via the network card).
    Shutter Light - Free monitoring activity and network data, to prevent unwanted sleep during Videos and to ensure the PC goes into sleep mode (disabling windows power management)
    Plex simplifies everything and acts as a great central server for all types of devices and can bring media files together from different Directories/Disks, in to one set of Libraries.

  • File.exists() is not accurate on smb2 network share (use WatchService?)

    Hi,
    According to this document: SMB2 Client Redirector Caches Explained File.exists() is not accurate on a smb2 network share. I am not able to change any register settings, so I want to deal with it. According to the document there is an API to get the notifications from the file system. I assumed that the WatchService is the Java implementation of this API. Am I correct?
    I started with the WatchDir example from the jdk samples and stripped it a bit. I only need to know when a file is created and delete (I don't care about file modifications). For testing I have added new File.exists() when a new event has been triggered. I also start a separated Thread which test the file existence also. When I don't start this separated thread the file exists returns true immediately. When the extra thread is started it is not accurate any more. I need a more accurate file.exists check in the whole application and all running threads.
    The output for my test case is this:
    FileExistsThread: subdir\test.txt == false
    watch registered for dir: subdir\
    FileExistsThread: subdir\test.txt == false
    FileExistsThread: subdir\test.txt == false
    FileExistsThread: subdir\test.txt == false
    FileExistsThread: subdir\test.txt == false
    FileExistsThread: subdir\test.txt == false
    FileExistsThread: subdir\test.txt == false
    WatchDir event: ENTRY_CREATE: test.txt
    WatchDir: subdir\test.txt exists == false
    FileExistsThread: subdir\test.txt == false
    FileExistsThread: subdir\test.txt == false
    FileExistsThread: subdir\test.txt == false
    FileExistsThread: subdir\test.txt == false
    FileExistsThread: subdir\test.txt == false
    FileExistsThread: subdir\test.txt == false
    FileExistsThread: subdir\test.txt == false
    FileExistsThread: subdir\test.txt == false
    FileExistsThread: subdir\test.txt == false
    FileExistsThread: subdir\test.txt == true
    FileExistsThread: subdir\test.txt == true
    FileExistsThread: subdir\test.txt == true
    FileExistsThread: subdir\test.txt == true
    As you can see the file test.txt  is created on line 9. The FileExistsThread have seen it on line 20, (at least 10 x 300 ms later).
    For testing I have used 2 Windows 7 pc's (with smb2 enabled which is default). The working directory must be on the remote pc and the file test.txt must be created (or copied from another folder) on the remote pc (not using the network drive, but on the pc itself).
    Here is my test code:
    package nl.test.main;
    import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;
    import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;
    import static java.nio.file.StandardWatchEventKinds.OVERFLOW;
    import java.io.File;
    import java.io.IOException;
    import java.nio.file.ClosedWatchServiceException;
    import java.nio.file.FileSystems;
    import java.nio.file.Path;
    import java.nio.file.Paths;
    import java.nio.file.WatchEvent;
    import java.nio.file.WatchKey;
    import java.nio.file.WatchService;
    public class WatchDir
      private final WatchService _watcher;
      private final String _dir;
      public WatchDir( String dir ) throws IOException
        _dir = dir;
        _watcher = FileSystems.getDefault().newWatchService();
        Paths.get( dir ).register( _watcher, ENTRY_CREATE, ENTRY_DELETE );
        System.out.println( "watch registered for dir: " + dir );
      public void run()
        try
          while ( true )
            WatchKey key = _watcher.take();
            for ( WatchEvent<?> event : key.pollEvents() )
              WatchEvent.Kind<?> kind = event.kind();
              if ( kind == OVERFLOW )
                continue;
              @SuppressWarnings( "unchecked" )
              WatchEvent<Path> ev = (WatchEvent<Path>)event;
              Path fileName = ev.context();
              System.out.println( "WatchDir event: " + kind.name() + ": " + fileName );
              if ( kind == ENTRY_CREATE )
                String realPath = _dir + fileName;
                System.out.println( "WatchDir: " + realPath + " exists == " + new File( realPath ).exists() );
            key.reset();
        catch ( ClosedWatchServiceException x )
          return;
        catch ( InterruptedException ex )
          return;
      public static void main( String[] args )
        Thread t = new Thread( new Runnable()
          @Override
          public void run()
            try
              while ( true )
                String filename = "subdir\\test.txt";
                boolean fileExists = new File( filename ).exists();
                System.err.println( "FileExistsThread: " + filename + " == " + fileExists );
                Thread.sleep( 300 );
            catch ( InterruptedException e )
              e.printStackTrace();
              return;
        t.start();
        try
          new WatchDir( "subdir\\" ).run();
        catch ( IOException e )
          e.printStackTrace();
    Any idea's?
    Thanks,
    Olaf

    If you donot have access to note 45172.1 as specified by Laurent Schneider.
    Snippet from note
    a. Mapped Drive : To use a mapped drive, the user that the service starts as
    must have setup a drive to match UTL_FILE_DIR and be logged onto the server
    when UTL_FILE is in use.
    b. Universal Naming Convention : UNC is preferable to Mapped Drives because
    it does not require anyone to be logged on and UTL_FILE_DIR should be set to
    a name in the form :
    \\\<machine name>\<share name>\<path>
    or
    "\\<machine name>\<share name>\<path>"

  • Time Machine Can Be Made to work with a Network Share

    FYI I am just posting this here for the benefit of the community. The source of this info is: http://forums.macrumors.com/showthread.php?t=375047
    As I write this, I am doing a Time Machine backup to a ReadyNAS NV+ afp mounted share. Here is a summary of what the thread above says you need to do. It worked for me.
    Take any supported USB standalone drive and plug it in to an available USB port.
    Use Disk Utility to format the drive (or partition on the drive) and name that partition to whatever you want your network share to be called. In my case, I called it "office-tm".
    After you do this, open the Time Machine preference panel and select that new drive (in my case "office-tm") to be the Time Machine backup drive.
    After Time Machine sets up the drive, it will start counting down before the next backup. Press the little X on the right side to cancel the backup.
    Now open a terminal session and change directories to /Volumes/<drive> where in my case <drive> was office-tm (cd /Volumes/office-tm).
    When you do a ls -a -l, you will see two important files. One starts with a period (.) and contains numbers after it. The other one is called .com.apple.timemachine.supported.
    What you need to do is copy these two files to your network share. The trick is that you want your network share to have the same name as this drive you just prepared (again, in my case it was called office-tm). I first created a new share on my ReadyNAS+ called office-tm and set the quotas properly.
    Then you need to copy the files. There are several ways to do this but the way I did it was that I temporarily mounted the network share at a different mount point in terminal just to get the files over. So for example, I did:
    sudo mount -t afp afp://<ip.addr.of.share>/office-tm /Volumes/office-tm2
    Then I copied the two files over (substitute your appropriate volume names):
    cp /Volumes/office-tm/.00whateveryourfilenameis /Volumes/office-tm2/.
    cp /Volumes/office-tm/.com.apple.timemachine.supported /Volumes/office-tm2/.
    Turn off Time Machine so you can unmount.
    Now you can unmount both the USB drive and the network share and then you remount the network share as the proper name. The same one that the USB drive was named so as far as Time Machine is concerned, the volume is still there. The two files are on the network share so all is fine and Time Machine can find the volume it expects.
    Wait for Time Machine to start it's hourly backup and away you go.
    PLEASE NOTE THIS DISCLAIMER - There is probably a good reason why Apple disabled this feature so you might want to think carefully before you rely on this hack published in the MacRumors forum to back up your Mac. I am using this for testing purposes only and I am still using traditional backup techniques for my "real" backup of my office machine. If you don't get good Time Machine backups and you have relied upon them for critical data, don't blame anyone but yourself.

    Name: RAIDiator
    Version: 3.01c1-p6
    Date: Tue Dec 12 17:46:22 2006
    Size: 46566912 bytes
    Reason: Final 6.
    We should probably start a new topic in networking on this. I am seeing some strangeness with afp shares as well.
    I have most shares set up to allow access by both CIFS/SMB and AFP. If I use Sidebar and try to access the shares by AFP, it says it can't connect to the server. But the same shares via CIFS works fine. (I can click on the "Windows" server icon and connect.) But for any of these shares, I can manually connect with the normal Go > Connect to Server... method, specifying afp://<ip address> and that works fine.
    In the case of the Time Machine share that is the subject of this post, I disabled CIFS and am only using AFP because I wanted to make sure I connected to the share only via AFP for Time Machine purposes.
    BTW, I do not use USER or DOMAIN security mode in my case and my shares are set up as SHARE security mode.

Maybe you are looking for

  • Issue in XL reporter on Client machine

    Hi Experts I am facing issue in running XL reporter on client machine aftre upgrading patch 10 of SAP B1 2007 B. System shows following errro Run TIme Error 430 Class does not support Automation or does not support expected interface. pls. help me ou

  • Service Error: File or assembly name Oracle.DataAccess not found

    Hi, everyone. I knew someone had post the similar question before. However, the discussion is not be able to solve my problem. Please give some suggestion. I got a net1 application use the oracle.dataAccess.dll as reference. I compiled it on my locat

  • Bug JDeveloper 10.1.3 : Backspace not working in .jspx source editing mode

    I checked the first 3 pages to see if someone else posted it and it don't look like it, so here I go. I just downloaded JDeveloper 10.1.3.0.4 and found out that backspace no longer work when editing a .jspx page in source mode but works fine in desig

  • Process Chain - Decision Step - 1st Day of Month

    Hi All, I have a process chain decision that detemines if it is 1st of Month, 1st Line Command -> IF Formula -> WORKINGDAY_MONTH( Current Date, 'IE', '' ) = 1 then Event - > Option 1 2nd Line Command -> Else IF Formula -> WORKINGDAY_MONTH( Current Da

  • 5.1 Sound on a 12" Powerbook

    I recently purchased the Logitech z5500's. What would be the best/cheapest way to get 5.1 sound out of my powerbook? I have the Soundblaster Live! 24-Bit External Sound Card, but I don't think the software is compatable with Macs. Any information you