I happened to notice that the rsync command was included on my HTC Desire, so I figured I could use it to send scripts to the device, but it also doubles as a very convenient way to backup my pictures and stuff. (It’s probably most convenient for unix users – which is whom this write-up is intended for. You can get rsync for Windows as well, but I haven’t used it much. YMMV.)
Anyway, to get started you need an rsyncd.conf file. Here’s mine, which I chose to place at /sdcard/rsyncd.conf:
port = 1234 pid file = /sdcard/rsyncd.pid [data] path = / list = false use chroot = false read only = false
Then I wrote two tiny shell scripts with ASE to start and stop the service:
rsync --config=/sdcard/rsyncd.conf --daemon
pid=`cat /sdcard/rsyncd.pid` kill $pid rm /sdcard/rsyncd.pid
Yes, I should add some sanity checks to verify it’s stopped or running, but I’m lazy.
I put short-cuts to the latter two on my phone’s “desktop” for easy access. Leaving it running permanently might not be such as good idea, unless you add rsync authentication. Or never use untrusted networks.
Anyway, with this setup you can easily copy scripts to the phone like so;
rsync blah.py rsync://192.168.1.100:1234/data/sdcard/ase/scripts/
Or backup your scripts (say, if you edit them on the phone);
rsync -av rsync://192.168.1.100:1234/data/sdcard/ase/ $HOME/ase-backup/
Or just browse:
(And if you don’t realize that you have to replace the IP address above with whatever address your device was assigned, this post probably isn’t for you.)
Hope someone finds this tip useful. I know I find it very handy.