Author Topic: USB hotplug + rsync [was: What runs on USB hotplug?]  (Read 2786 times)

havoc

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
    • http://www.galacticslacker.com/
USB hotplug + rsync [was: What runs on USB hotplug?]
« on: February 22, 2004, 11:24:33 pm »
I\'ve searched around, and maybe I\'m just using the wrong search terms, but I was just wandering what runs (on the Zaurus end) when the device is set into the cradle, and it does it\'s hotplug thing?

Or, does everything happen on the PC end?

If the only thing that happens is on the PC-end, I\'m running SuSE Linux 9.

And... why doesn\'t the Z log anything more than boot messages?

lardman

  • Hero Member
  • *****
  • Posts: 4512
    • View Profile
    • http://people.bath.ac.uk/enpsgp/Zaurus/
USB hotplug + rsync [was: What runs on USB hotplug?]
« Reply #1 on: February 23, 2004, 05:41:55 am »
Background: http://linux-hotplug.sourceforge.net/

Take a look at the scripts and see for yourself.

With two Linux boxes the hotplugging will happen at both ends.

Logging - Which ROM are you using? You might want to run syslogd, then edit /etc/syslogd.conf


Si
C750 OZ3.5.4 (GPE, 2.6.x kernel)
SL5500 OZ3.5.4 (Opie)
Nokia 770
Serial GPS, WCF-12, Socket Ethernet & BT, Ratoc USB
WinXP, Mandriva

havoc

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
    • http://www.galacticslacker.com/
USB hotplug + rsync [was: What runs on USB hotplug?]
« Reply #2 on: February 23, 2004, 12:21:25 pm »
Thanks for the scoop, lardman.

My original idea was to have the notebook do the rsync, since it\'s easy to find triggers on a standard Linux box.  Unfortunately,
<tt>rsync -blahblah \"ssh -i path/to/key\" zaurus@192.168.129.201:.  local/path</tt>

gave me an error that rscync wasn\'t found.  Turns out that the ipk doesn\'t put rsync in a path that zaurus can find.  So I tried rsyncing with the root user, and got the same problem

Go figure.  None the less, I can have the root user on the Z rsync the zaurus files to the notebook, preserve all the file permissions, user and group info, and I\'m done.

Now, I have some reading to do as soon as I find time!

zbones

  • Sr. Member
  • ****
  • Posts: 459
    • View Profile
USB hotplug + rsync [was: What runs on USB hotplug?]
« Reply #3 on: February 23, 2004, 02:12:10 pm »
use
Code: [Select]
--rsync-path=PATH where path is the location including the rsync binary,

ie
Code: [Select]
--rsync-path=/usr/local/bin/rsync

Peter
Zaurus cl760, cacko QT rom. Zaurus sl5500 with TKCrom 1.0.
512mb Kingston cf card, 256mb Sandisk sd card, Lexar 256mb sd card.
Bluemonkey bluetooth card <-> Sony Ericsson k700i for gprs.
Buffalo WLI-CF-S11G wifi card. Haicom 303 mmf gps cf/seral card.

havoc

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
    • http://www.galacticslacker.com/
USB hotplug + rsync [was: What runs on USB hotplug?]
« Reply #4 on: February 23, 2004, 02:32:04 pm »
Thanks, zbones.

I still have not figured out how to have the command run automatically when the USB connection hotplug is detected and configured.

.....

Hold on.  *epiphiny!*  just noticed that my /var/log/rsync_error has changed....

OKAY!

I added the following line as the last line in /etc/hotplug/hotplug.functions

(sleep 20; /home/QtPalmtop/bin/rsync -avC -pogt --progress -e \"ssh -i /home/zaurus/.ssh/zaurus_key\" /home/zaurus/ bigpig@192.168.129.1:.zaurus ] /var/log/rsync_log 2] /var/log/rsync_error) &

It was failing because it was running before all of the housekeeping was done, so I put a 20 sec sleep in there, and it worked.

You\'ll have to create an ssh key pair for the zaurus using ssh-keygen, make sure the private key is in the /home/zaurus/.ssh dir, put a copy of the public key in your desktop/notebook\'s .ssh dir.  Add that key to the .ssh/authorized_keys file, make sure that you\'ve logged into the desktop/notebook at least once from the Z so that the Z\'s key will be in the .ssh/known_host file, and you\'re good.

Let me know if there\'s enough interest that I need to write a HOWTO for this.