EricDB
July 11th, 2008, 09:43 PM
I'm writing a little script to backup some files periodically and automatically to my NAS, whenever my laptop connects to my home network. My plan is to run it every five minutes or so from cron, and have it check to see whether the NAS is mounted, and if so, do the backup (provided it hasn't been done today already).
So, I'm using os.path.exists to check. The probem is, it returns True if the NAS is mounted, but if not, it just blocks (seemingly) forever. Is there a better way to check?
Incidentally, what usually happens is that the NAS is mounted when I'm at home, then I suspend, resume somewhere else, and although the icon is still on my desktop, obviously I have no access.
So, I'm using os.path.exists to check. The probem is, it returns True if the NAS is mounted, but if not, it just blocks (seemingly) forever. Is there a better way to check?
Incidentally, what usually happens is that the NAS is mounted when I'm at home, then I suspend, resume somewhere else, and although the icon is still on my desktop, obviously I have no access.