Author Topic: How to trigger a script with putting Z on cradle?  (Read 2430 times)

cmisip

  • Sr. Member
  • ****
  • Posts: 256
    • View Profile
    • http://home.mchsi.com/~cmisip/index.htm
How to trigger a script with putting Z on cradle?
« 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
Zaurus 5600
Zynergy Rootfs 1.1
Custom zImage

How Do You Do That in Linux

tumnus

  • Hero Member
  • *****
  • Posts: 1176
    • View Profile
    • http://www.cpinkney.org.uk
How to trigger a script with putting Z on cradle?
« Reply #1 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.
# Search the Zaurus Howtos ## Search the Zaurus FAQs ## Find Z software at ELSI #
--------------------
UK SL5500 with Sharp ROM 3.13, SL5600 with Sharp ROM 1.32 - SuSE 9.0 Pro, Windows XP Home
Qualendar for Calendar and Todo
Socket Bluetooth CF Card (Rev F), Kingmax 512MB MMC Card, Palm Tungsten T Stylus,
Pretec CF->Smartmedia Adapter, Semsons Universal Battery Extender

cmisip

  • Sr. Member
  • ****
  • Posts: 256
    • View Profile
    • http://home.mchsi.com/~cmisip/index.htm
How to trigger a script with putting Z on cradle?
« Reply #2 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.
Zaurus 5600
Zynergy Rootfs 1.1
Custom zImage

How Do You Do That in Linux

doseas

  • Full Member
  • ***
  • Posts: 207
    • View Profile
    • http://
How to trigger a script with putting Z on cradle?
« Reply #3 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.