View Single Post
Posts: 167 | Thanked: 204 times | Joined on Jul 2010
#5
Originally Posted by iceskateclog View Post
Nice thread.

What about when you're offline? How to queue taken photos and upload only when connected through WiFi?
There's a few ways to do that, none of them directly related to inotify.

Using the e-mail option in the last post, e-mails are created in Modest's outbox and can be sent immediately if we're online and that's what's configured, or will be stored in the Outbox until we do get connected. That's one option, if you're happy for the uploads to follow the same defaults as the e-mail client.

If you want to be more sophisticated than that, you'll want to use an incremental backup protocol, such as rsync over SSH, which can synchronise a directory based upon what needs doing at the time. There are plenty of HOWTOs and scripts for the purpose, most of which assume that you'll run the rsync from cron.

You want it only to happen when you're on WiFi; there are a couple of ways that you can achieve that. One is to launch your script from cron but abort silently if we're not on WiFi; an easy way to check that is with iwgetid from the wireless-tools package. You could also use dbus-scripts and react to a connection to a WiFi network, although I haven't found that to be 100% reliable.
 

The Following 4 Users Say Thank You to magick777 For This Useful Post: