OESF Portables Forum

Everything Else => Zaurus Distro Support and Discussion => Distros, Development, and Model Specific Forums => Archived Forums => Sharp ROMs => Topic started by: lpetroni on January 20, 2007, 06:32:11 pm

Title: Autostart / Stop Samba On Wifi Card Insertion
Post by: lpetroni on January 20, 2007, 06:32:11 pm
Just installed Cacko/Crow ROM (home on SD) + Cacko Kernel Update.

My WiFi Card is recognized with no problems and I was able to configure Samba over WiFi based on the guidelines posted on ZUG. The only problem is that Samba only auto starts on USB but I would like it to autostart when I insert my WiFi card and autostop when the card is removed.

So far I can only start Samba manually using samba start and stop commands.

Code: [Select]
#su
#/etc/rc.d/init.d/samba start

Complete Linux newbie here  
 
How do I write a script and where should it be placed?

Thanks!
Title: Autostart / Stop Samba On Wifi Card Insertion
Post by: bam on January 20, 2007, 10:26:05 pm
you might look for network helper applet
Title: Autostart / Stop Samba On Wifi Card Insertion
Post by: lpetroni on January 21, 2007, 07:47:14 am
Thanks for the reply bam.

For networkd helper applet you mean the Network Config Applet used to setup configurations (LAN/Wireless/IrDA) which is already installed with the system or a new ipk that I should install?

I did not find any option to autostart/stop Samba on Network Config Applet.

Thanks!


Quote
you might look for network helper applet
[div align=\"right\"][a href=\"index.php?act=findpost&pid=151853\"][{POST_SNAPBACK}][/a][/div]
Title: Autostart / Stop Samba On Wifi Card Insertion
Post by: speculatrix on January 21, 2007, 09:59:48 am
take a look in the /etc/pcmcia directory, lots of interesting scripts in there. be sure to take a backup copy before changing
Title: Autostart / Stop Samba On Wifi Card Insertion
Post by: lpetroni on January 25, 2007, 08:24:55 am
Quote
take a look in the /etc/pcmcia directory, lots of interesting scripts in there. be sure to take a backup copy before changing
[div align=\"right\"][a href=\"index.php?act=findpost&pid=151903\"][{POST_SNAPBACK}][/a][/div]

Thanks for reply speculatrix. I will check your suggestion.

I suppose that a script is a plain text file with some kind of extension added to its name to identify it as a script. Is it right?

Is there any way to create a applet or a icon associated with this script ?

My idea was to plug my wifi card, start samba (using this applet/icon) and then make a connection with my mac.
Title: Autostart / Stop Samba On Wifi Card Insertion
Post by: speculatrix on January 25, 2007, 10:23:08 am
Quote
Thanks for reply speculatrix. I will check your suggestion.

I suppose that a script is a plain text file with some kind of extension added to its name to identify it as a script. Is it right?

Is there any way to create a applet or a icon associated with this script ?

My idea was to plug my wifi card, start samba (using this applet/icon) and then make a connection with my mac.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=152377\"][{POST_SNAPBACK}][/a][/div]

a script is a text file whose first line identifies the intepreter, e.g. "#!/bin/bash" or "#!/bin/perl", where the magic part is the #!, and is then set executable, so when you "ls -la" it will look like this

-rwxr-xr-x ......

it's not like DOS/Windows where the file extension is implicit in the execution

adding icons to the desktop to run scripts is a different thing altogether, but yes, it is possible. There are various discussions about it here on the forum, I don't have a link to hand.
Title: Autostart / Stop Samba On Wifi Card Insertion
Post by: lpetroni on January 25, 2007, 03:09:33 pm
Quote
a script is a text file whose first line identifies the intepreter, e.g. "#!/bin/bash" or "#!/bin/perl", where the magic part is the #!, and is then set executable, so when you "ls -la" it will look like this

-rwxr-xr-x ......

[div align=\"right\"][a href=\"index.php?act=findpost&pid=152392\"][{POST_SNAPBACK}][/a][/div]


Speculatrix,

I created a simple text file using TextEdit:


#! /bin/bash
cd /
/etc/rc.d/init.d/samba start


Thens saved it under Documents/MyScripts/sambaup.txt
Renamed the file deleting the .txt extension.

Opened terminal and cd to Documents/MyScripts, then ls -la

It shows sambaup as

-rw-r--r-- .... so, no "x" (executable?)...

Is there any additional step to make the script executable so that I can run it in terminal and later assign it to a icon?

Sorry but I'm having a hard time with Linux  
Title: Autostart / Stop Samba On Wifi Card Insertion
Post by: grog on January 25, 2007, 03:42:47 pm
Quote
#! /bin/bash
cd /
/etc/rc.d/init.d/samba start
Make sure there's no space in the first line:

Code: [Select]
#!/bin/bashWhy the 'cd /' line? Shouldn't be necessary.

Quote
Thens saved it under Documents/MyScripts/sambaup.txt
Renamed the file deleting the .txt extension.

Opened terminal and cd to Documents/MyScripts, then ls -la

It shows sambaup as

-rw-r--r-- .... so, no "x" (executable?)...

Is there any additional step to make the script executable so that I can run it in terminal and later assign it to a icon?

Code: [Select]
chmod 755 ~/Documents/MyScripts/sambaup.txt
Quote
Sorry but I'm having a hard time with Linux 
[div align=\"right\"][a href=\"index.php?act=findpost&pid=152436\"][{POST_SNAPBACK}][/a][/div]
No need to apologize. We all started from the same place
HTH