You are not logged in.

#1 2012-07-10 15:55:46

fpilee
Member
From: Windows 7
Registered: 2011-10-06
Posts: 104
Website

Help with init script of Network

hi everyone.

I need help to make my wifi init script.

I have this script called "red" added on daemons en rc.conf

#!/bin/bash
killall dhcpcd
killall wpa_supplicant
ifconfig wlan0 up
iwconfig wlan0 essid [ESSID]
wpa_supplicant -B -Dwext -i wlan0 -c [PASSFILE]
dhcpcd -q wlan0

It work well on boot, but if connection loose, i have to reboot the system to have internet again. I want  use "start, stop, and reload" commands XD

Last edited by fpilee (2012-07-10 15:56:46)

Offline

#2 2012-07-10 18:44:54

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Help with init script of Network

This is like ignoring the spoon on the table and using your shoe instead to eat soup in a restaurant.

Why don't you use the net-profiles daemon? This is exactly what it is meant to do and it's dead-simple It even includes examples of how to set up wpa_supplicant. Install netcfg and use /etc/network.d/examples/wireless-wpa-config as a template. Refer to the netcfg man page for help setting the rest of it up. All you really need to do is create a profile using that template, and then add it to /etc/conf.d/netcfg.


Also, daemons follow a very specific format. You can't just throw any script in /etc/rc.d and expect it to act as a daemon. Open up the other daemons and see how they work.

Take time to think about what you're doing.  You'll lose less in the end.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#3 2012-07-10 22:21:06

fpilee
Member
From: Windows 7
Registered: 2011-10-06
Posts: 104
Website

Re: Help with init script of Network

Well, i used Netcfg on my first install on arch linux, i forgot it...

Last edited by fpilee (2012-07-10 22:22:11)

Offline

#4 2012-07-11 20:00:49

fpilee
Member
From: Windows 7
Registered: 2011-10-06
Posts: 104
Website

Re: Help with init script of Network

same shit like my script, i have to reboot system when connection loose

Offline

#5 2012-07-11 20:13:02

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Help with init script of Network

fpilee wrote:

same ---- like my script, i have to reboot system when connection loose

I just looked at some of the code for netcfg.

It doesn't seem at all like your script.  Specifically it has a case statement to respond to commands like start stop and restart.  Additionally it is formated (As Xyne already mentioned) as other daemons are so it works properly in that context.

If you have an issue with netcfg, please include information on what commands you have used, and what errors you get.

Otherwise ... be careful not to choke on the laces.

Last edited by Trilby (2012-07-11 20:13:23)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2012-07-13 03:50:58

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,965
Website

Re: Help with init script of Network

Post your netcfg profile and config, along with any error messages that you're getting. Check that logs in /var/log too. You should not need to reboot to get a connection. I suspect that you're doing omething wrong.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#7 2012-07-14 15:11:31

fpilee
Member
From: Windows 7
Registered: 2011-10-06
Posts: 104
Website

Re: Help with init script of Network

don't work on boot, i follow the wiki and "net-profiles" daemon don't exist so i put netcfg,  but not work on bott... fwa

Offline

#8 2012-07-14 15:19:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Help with init script of Network

fpilee, I was a bit direct above, but I think Xyne is being rather patient ... but you should not expect any help when your posts offer little more than "don't work" - especially when you've just been asked for relevant information that you chose not to provide.

If you want solutions, you need to be more forthcoming.  If you want someone to listen to your grips, find (and tip) a bartender.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2012-07-14 18:46:14

fpilee
Member
From: Windows 7
Registered: 2011-10-06
Posts: 104
Website

Re: Help with init script of Network

/etc/network.d/mynetwork

CONNECTION='wireless'
DESCRIPTION='A simple WPA encrypted wireless connection'
INTERFACE='wlan0'
SECURITY='wpa'

ESSID=''
## Uncomment if the supplied ESSID is hexadecimal
#ESSID_TYPE='hex'
KEY=''

IP='dhcp'

# Uncomment this if your ssid is hidden
HIDDEN=yes


errors:
:: mynetwork up                                                                                                                                                                                                                         
[BUSY]  > DHCP IP lease attempt failed.
                                                                                                                                                                                                                                       
[FAIL]
> No profile started.

Last edited by fpilee (2012-07-14 18:46:43)

Offline

#10 2012-07-15 20:02:38

fpilee
Member
From: Windows 7
Registered: 2011-10-06
Posts: 104
Website

Re: Help with init script of Network

its working good right now. tongue

Offline

#11 2012-07-15 20:51:53

Darksoul71
Member
Registered: 2010-04-12
Posts: 319

Re: Help with init script of Network

Then do not forget to add solved to your topic smile


My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick

Offline

Board footer

Powered by FluxBB