OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Autostart / Stop Samba On Wifi Card Insertion, How to and where to put the script?
lpetroni
post Jan 20 2007, 03:32 PM
Post #1





Group: Members
Posts: 52
Joined: 5-June 05
Member No.: 7,271



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
#su
#/etc/rc.d/init.d/samba start


Complete Linux newbie here sad.gif

How do I write a script and where should it be placed?

Thanks!
Go to the top of the page
 
+Quote Post
bam
post Jan 20 2007, 07:26 PM
Post #2





Group: Members
Posts: 1,213
Joined: 9-June 05
From: Gobi Desert, Mongolia
Member No.: 7,306



you might look for network helper applet
Go to the top of the page
 
+Quote Post
lpetroni
post Jan 21 2007, 04:47 AM
Post #3





Group: Members
Posts: 52
Joined: 5-June 05
Member No.: 7,271



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(bam @ Jan 21 2007, 01:26 AM)
you might look for network helper applet
*
Go to the top of the page
 
+Quote Post
speculatrix
post Jan 21 2007, 06:59 AM
Post #4





Group: Admin
Posts: 3,281
Joined: 29-July 04
From: Cambridge, England
Member No.: 4,149



take a look in the /etc/pcmcia directory, lots of interesting scripts in there. be sure to take a backup copy before changing smile.gif
Go to the top of the page
 
+Quote Post
lpetroni
post Jan 25 2007, 05:24 AM
Post #5





Group: Members
Posts: 52
Joined: 5-June 05
Member No.: 7,271



QUOTE(speculatrix @ Jan 21 2007, 12:59 PM)
take a look in the /etc/pcmcia directory, lots of interesting scripts in there. be sure to take a backup copy before changing smile.gif
*


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.
Go to the top of the page
 
+Quote Post
speculatrix
post Jan 25 2007, 07:23 AM
Post #6





Group: Admin
Posts: 3,281
Joined: 29-July 04
From: Cambridge, England
Member No.: 4,149



QUOTE(lpetroni @ Jan 25 2007, 02:24 PM)
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.
*


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.
Go to the top of the page
 
+Quote Post
lpetroni
post Jan 25 2007, 12:09 PM
Post #7





Group: Members
Posts: 52
Joined: 5-June 05
Member No.: 7,271



QUOTE(speculatrix @ Jan 25 2007, 01:23 PM)
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 ......

*



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 sad.gif
Go to the top of the page
 
+Quote Post
grog
post Jan 25 2007, 12:42 PM
Post #8





Group: Members
Posts: 692
Joined: 27-January 04
From: Canada
Member No.: 1,564



QUOTE(lpetroni @ Jan 25 2007, 02:09 PM)
#! /bin/bash
cd /
/etc/rc.d/init.d/samba start

Make sure there's no space in the first line:

CODE
#!/bin/bash

Why 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
chmod 755 ~/Documents/MyScripts/sambaup.txt


QUOTE
Sorry but I'm having a hard time with Linux  sad.gif
*

No need to apologize. We all started from the same place smile.gif
HTH
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 30th July 2014 - 03:18 PM