OESF Portables Forum

General Forums => General Discussion => Topic started by: cmisip on June 08, 2004, 11:57:13 pm

Title: How to trigger a script with putting Z on cradle?
Post by: cmisip on June 08, 2004, 11:57:13 pm
Does anybody know how to do this?  I have successfully used /etc/hotplug/net.agent to run ntpdate each time the zaurus is connected to the cradle.  However, net.agent behaves strangely.  It attempts to run the \"unregister\" part of the script and then runs the \"register\" part of the script.  The end result is that it works, since I put ntpdate on the \"register\" part of the script.  However, I need to trigger another script when the zaurus is removed from the cradle.  Anybody know how to do this?

Thanks
Title: How to trigger a script with putting Z on cradle?
Post by: tumnus on June 09, 2004, 02:30:19 am
Which Linux distro are you using? I\'ve done exactly this, using net.agent, to mount a Samba share from my Zaurus and backup all my data in /home/zaurus/Applications when I put my Zaurus in the cradle and then unmount the share before the network connection is removed. As far as I know the unregister function does not get called before register on my Linux box.
Title: How to trigger a script with putting Z on cradle?
Post by: cmisip on June 09, 2004, 04:27:53 pm
I am using redhat 9 for the desktop machine and zynergy 1.1 for the zaurus.  It turns out that /etc/hotplug/usbdnet is not needed on redhat 9.  It automatically starts the usb0 interface as long as you have the correct settings in ifcfg-usb0.  My problem is with the zaurus.  /etc/hotplug/net.agent gets called when the zaurus is inserted in the usb cradle, but for some reason, unregister gets called first before register.  I found this out by inserting a flite command in both the register and unregister parts of usbdnet.   The zaurus cannot anticipate when I will remove it from the cradle, so I need something that is triggered by removal of the zaurus from the cradle.  Basically, when I put the zaurus on the cradle, I want ntpdate to run, take down shorewall and shut down ipsec, tell wwwoffle that it is online.  When I remove the cradle, I want the zaurus to remove the usbd0 interface,  tell wwwoffle that it is offline.
Title: How to trigger a script with putting Z on cradle?
Post by: doseas on June 10, 2004, 02:21:23 pm
On the Sharp 2.x ROM, I used to have a script run everytime I put the Z in the cradle (/usr/local/bin/cradle -- how original!) to set up my network routing.

To get this to work, I added a line to call my script in the usbd0 -] register part of /home/etc/hotplug/usbd.agent, just after the \"ifconfig usbd0 $IP\" line.