Help - Search - Members - Calendar
Full Version: How to trigger a script with putting Z on cradle?
OESF Portables Forum > General Forums > General Discussion
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?

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.
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.
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.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2019 Invision Power Services, Inc.