2019-08-31

WIFI on the Pocket Beagle

WIFI...

To make the WIFI dongle start on boot..

In the terminal, we will write a script to start the WIFI dongle. First make a directory for the script.

mkdir /opt/scripts/wifi_start

Then write the script:

nano /opt/scripts/wifi_start/wifi_start.sh

In the editor type:

#!/bin/bash

sleep 30s
connmanctl
connmanctl enable offline
connmanctl disable offline
done

The above 'sleep 30s' allows time for 'net.connman' to start. Need to figure out how to test for one service before starting another.

Now make the script executable.

chmod +x /opt/scripts/wifi_start/wifi_start.sh

Now to make the above a service that will run at boot.

Create the service file:

sudo nano /lib/systemd/system/wifi_start.service

And enter the below:

[Unit]
Description=WIFI Dongle Start

[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/bash /opt/scripts/wifi_start/wifi_start.sh

[Install]
WantedBy=multi-user.target
Alias=wifi_start.service

To enable the service so it will run automatically after the system boots.

sudo systemctl enable wifi_start.service

To start the service without rebooting.

sudo systemctl start wifi_start.service

In the event you change 'wifi_start.sh' and want to run the changes.

sudo systemctl restart wifi_start.service

To disable the service so it will not start after a reboot.

sudo systemctl disable wifi_start.service

To check the status

sudo systemctl status  wifi_start.service