Automatic connect with network manager before user logs in

Hi,

I am doing research to configure notebooks for usage at school.

Those notebooks will be given to students to be used at home and at school. So obviously one cannot use wicked, network manager has to be used.

I´d like to have the following behaviour: When at school, the notebook should look for some maintainance-skripts on the server.

So I´d like to have a skript somewhere that uses network manager to check if the school´s wlan is present, then connect to it, download the newly available maintainance-skripts and then execute them.

I am unsure where to put that skript. If I add it to boot.local, I think that´s too early. Maybe runlevel 5 would be a good idea.

So before I put a lot of work into it, I´d like to know if it is even possible to do that. I outline what I want:

  • start a skript before user login
  • use network manager in the skript to check if school wlan is present
  • if so, connect to it and start maintainance.

This should work in the background, so the user can login while, for instance, updates are running.

We are doing this right now, but with wicked, for notebooks that stay at school, but with wicked one can only configure one single WLAN. Here, at startup a maintainance-skript is executed (to make updates, install additional software, change some settings etc.).

Another issue is hibernation / standby, I have no Ideas as of yet how to handle that ( for the existing notebooks, I gave strict orders to really shutdown them after usage, but if this is not done, the start-skript isn´t executed, and maintainance won´t be done before the next user logs in).

I hope I made myself clear. Future plans are to give notebooks to approx. 1000 students, so I really need ways of automatic maintainance via scripts. If you have ideas that go into a completely different direction, please tell me so, too.

Thanks for your help,

Andreas

Am Thu, 30 Mar 2017 10:16:01 GMT
schrieb goeba <goeba@no-mx.forums.microfocus.com>:

> Hi,
>
> I am doing research to configure notebooks for usage at school.
>
> Those notebooks will be given to students to be used at home and at
> school. So obviously one cannot use wicked, network manager has to be
> used.
>
> I´d like to have the following behaviour: When at school, the notebook
> should look for some maintainance-skripts on the server.
>
> So I´d like to have a skript somewhere that uses network manager to
> check if the school´s wlan is present, then connect to it, download the
> newly available maintainance-skripts and then execute them.
>
> I am unsure where to put that skript. If I add it to boot.local, I think
> that´s too early. Maybe runlevel 5 would be a good idea.
>
> So before I put a lot of work into it, I´d like to know if it is even
> possible to do that. I outline what I want:
>
> - start a skript before user login
> - use network manager in the skript to check if school wlan is present
> - if so, connect to it and start maintainance.
>
> This should work in the background, so the user can login while, for
> instance, updates are running.
>
> We are doing this right now, but with wicked, for notebooks that stay at
> school, but with wicked one can only configure one single WLAN. Here, at
> startup a maintainance-skript is executed (to make updates, install
> additional software, change some settings etc.).
>
> Another issue is hibernation / standby, I have no Ideas as of yet how to
> handle that ( for the existing notebooks, I gave strict orders to really
> shutdown them after usage, but if this is not done, the start-skript
> isn´t executed, and maintainance won´t be done before the next user
> logs in).
>
> I hope I made myself clear. Future plans are to give notebooks to
> approx. 1000 students, so I really need ways of automatic maintainance
> via scripts. If you have ideas that go into a completely different
> direction, please tell me so, too.
>
> Thanks for your help,
>
> Andreas
>
>

If configured as a system connection, NWM will exactly do that (connect
automatically if respective SSID is available).

Using a dispatcher script in /etc/Networkmanager/dispatcher.d/ and adding a
check for which SSID the machine is connected to will be enough to trigger any
action you would like if connected to that SSID. As that script will be
executed when connecting/disconnecting (with respective actions you tell itto
do), no need for any extra triggers when suspending/hibernating.

AK


Never attribute to malice that which can be adequately explained by stupidity.
(R.J. Hanlon)

Hi,
thanks a lot. This is much better than what I was thinking about.

Sorry for the late reply, I had mail notification set to “on” but somehow didn´t get any mail.

I´ll test that and report if it works.

Andreas

Am Fri, 31 Mar 2017 12:56:01 GMT
schrieb goeba <goeba@no-mx.forums.microfocus.com>:

> Hi,
> thanks a lot. This is much better than what I was thinking about.
>
> Sorry for the late reply, I had mail notification set to “on” but
> somehow didn´t get any mail.
>
> I´ll test that and report if it works.
>
> Andreas
>
>

For the record (and especially for other users reading this thread later).

Use and syntax of dispatcher scripts is explained pretty well in

man NetworkManager

(Section DISPATCHER_SCRIPTS)

It should not be a problem any more, but just in case that NetworkManager does
not fully reactivate after suspend/hibernate, this is a good read in how to
solve such problems.

https://wiki.archlinux.org/index.php/Power_Management#Sleep_hooks

(Adding a hook to restart the NetworkManager service would do the trick.)

This link is also useful for any other service or any other action to be
executed before/after suspending/hibernating or waking up the machine.

AK


Never attribute to malice that which can be adequately explained by stupidity.
(R.J. Hanlon)