You are not logged in.

#1 2015-11-06 16:33:06

GigiAriete
Member
Registered: 2015-10-08
Posts: 9

Netctl-auto

Hi all,
I've some netctl-auto profiles.
In particular there are some connections without protection.
I'd like to open automatically the internet page for login after the
wireless connection for these.

For example:
in /bin/bash I've got:

LoginPage.sh

 #!/bin/bash
check=`iwconfig wlp2s0 | grep "publicConn"`
if [ -n "$check" ]; then
    firefox --new-window https://login.com &
fi 

in /etc/netctl I've got the profile for the connection:
wlp2s0-publicConn:
I've just added:

 ExecUpPost="LoginPage.sh" 

but doesn't work. No firefox pages are opened.

Thx in advance for help

Offline

#2 2015-11-06 20:18:28

dif
Member
From: Stalowa Wola, Poland
Registered: 2009-12-22
Posts: 137

Re: Netctl-auto

(1) netctl-auto starts at boot and a network connection is made before X, so firefox cannot start at boot.
(2) netctl is started by root; not by your user
(3) /bin is a link to /usr/bin, and bash is a binary file not a directory, so you cannot have a script in /bin/bash.
(4) I don't really understand what  you want to do. Is the word "Login" used in connection with actual attempt to log in or do you just want to open the web page "login.com" whenever your computer connects to a new network automatically?

Think about (1), (2), and (3).

Offline

#3 2015-11-07 11:04:12

GigiAriete
Member
Registered: 2015-10-08
Posts: 9

Re: Netctl-auto

dif wrote:

(1) netctl-auto starts at boot and a network connection is made before X, so firefox cannot start at boot.
(2) netctl is started by root; not by your user
(3) /bin is a link to /usr/bin, and bash is a binary file not a directory, so you cannot have a script in /bin/bash.
(4) I don't really understand what  you want to do. Is the word "Login" used in connection with actual attempt to log in or do you just want to open the web page "login.com" whenever your computer connects to a new network automatically?

Think about (1), (2), and (3).

Thanks for the reply dif,

1) Yes, you are right. So I can't open any firefox pages? I've to check if X is started? How? :-S
2) I don't understand what is the problem
3) The script is in /bin obviously, I was wrong.
4) I'm trying to open the web page "login.com" (for example) if the connection "publicConn" is active

Sorry for the confusion and thank you very much for your help

Offline

#4 2015-11-08 01:51:10

techwiz
Member
Registered: 2012-01-26
Posts: 48

Re: Netctl-auto

Firefox, like Chrome and many browsers today create user profiles so opening firefox as root will not function the same as opening it as user. Also, I don't think systemd has X stuff set in env so even if netctl started after X, it wouldn't be able to find the server I don't think.

IMO, you'd be better off setting this up in your .bashrc if you really need it at start up, or preferably, maybe network-manager can run the script for you (assuming you have a GUI like gnome running as well). I would expect strange behavior as firefox tries to figure out where to draw itself though, especially if Gnome and Firefox race.

Offline

Board footer

Powered by FluxBB