Author Topic: Stopping/starting Samba Automatically  (Read 2636 times)

maystorm

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • http://
Stopping/starting Samba Automatically
« on: July 27, 2006, 03:41:57 pm »
I'm looking for ways to automatically start the samba server whenever a Wifi CF card is inserted or resumed. And to automatically stop it when the card is suspended or ejected.

Is there anywhere a central script which catches globally those resume/suspend and insert/eject events so that I can add the corresponding samba start and stop commands there?

TIA for hints!
Owner of a very happy Zaurus SL-C3000 since the day he was fed with pdaXrom 1.1.0beta1! Just made him even more happy by feeding him with pdaXii13 build 5.4.7.

karlto

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
    • http://
Stopping/starting Samba Automatically
« Reply #1 on: July 27, 2006, 05:55:08 pm »
Quote
I'm looking for ways to automatically start the samba server whenever a Wifi CF card is inserted or resumed. And to automatically stop it when the card is suspended or ejected.

Is there anywhere a central script which catches globally those resume/suspend and insert/eject events so that I can add the corresponding samba start and stop commands there?

TIA for hints!
[div align=\"right\"][a href=\"index.php?act=findpost&pid=136638\"][{POST_SNAPBACK}][/a][/div]
Resume and suspend scripts are in /etc/apm. The eject and insert stuff seems like a hotplug script would be the ideal solution, but I think pdaXrom only uses hotplug for USB. How do you connect and disconnect from the wireless network? Perhaps just insert the commands into your scripts for this.
SL6000-L, RC12

maystorm

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • http://
Stopping/starting Samba Automatically
« Reply #2 on: July 27, 2006, 06:18:21 pm »
Quote
How do you connect and disconnect from the wireless network? Perhaps just insert the commands into your scripts for this.
When I manually suspend and resume I call self-made scripts containing "cardctl suspend", "cardctl resume", "cardctl insert" and "cardctl eject" commands and it would be no problem to also include the appropriate samba stop and start sequences.

However, when I plug in the WiFi card my C3000 automatically connects the card and I don't need to call one of my scripts. Also when suspending and resuming the whole Zaurus the WiFi stuff is automatically executed w/o the need to call my scripts. In these cases the samba server is not correctly stopped and started.

So I thought there must be some system scripts which are automatically called by some  mechanism. Is it hotplug? Dunno. I've not yet looked into the inner workings of hotplug and what scripts are involved.

Can somebody confirm whether it is hotplug doing this "magic stuff"?
« Last Edit: July 27, 2006, 06:18:45 pm by maystorm »
Owner of a very happy Zaurus SL-C3000 since the day he was fed with pdaXrom 1.1.0beta1! Just made him even more happy by feeding him with pdaXii13 build 5.4.7.

karlto

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
    • http://
Stopping/starting Samba Automatically
« Reply #3 on: July 27, 2006, 08:47:43 pm »
Quote
Quote
How do you connect and disconnect from the wireless network? Perhaps just insert the commands into your scripts for this.
When I manually suspend and resume I call self-made scripts containing "cardctl suspend", "cardctl resume", "cardctl insert" and "cardctl eject" commands and it would be no problem to also include the appropriate samba stop and start sequences.

However, when I plug in the WiFi card my C3000 automatically connects the card and I don't need to call one of my scripts. Also when suspending and resuming the whole Zaurus the WiFi stuff is automatically executed w/o the need to call my scripts. In these cases the samba server is not correctly stopped and started.

So I thought there must be some system scripts which are automatically called by some  mechanism. Is it hotplug? Dunno. I've not yet looked into the inner workings of hotplug and what scripts are involved.

Can somebody confirm whether it is hotplug doing this "magic stuff"?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=136653\"][{POST_SNAPBACK}][/a][/div]
The scripts in /etc/apm are always called when suspending and resuming (a number of these are part of the standard installation which you can modify), so that part should be easy.

I would have thought that something similar happens when you insert the card, but I'm not sure exactly how that works (my Zaurus is an SL6000, so the wifi is built-in, and I just turn it on and off when I need it).

If hotplug is involved, I imagine it will leave its calling card in dmesg each time you insert/eject the card, so check that out.
SL6000-L, RC12

maystorm

  • Newbie
  • *
  • Posts: 48
    • View Profile
    • http://
Stopping/starting Samba Automatically
« Reply #4 on: July 28, 2006, 03:19:54 am »
Thanks for these hints! That's something I'll can now dig into!
Owner of a very happy Zaurus SL-C3000 since the day he was fed with pdaXrom 1.1.0beta1! Just made him even more happy by feeding him with pdaXii13 build 5.4.7.