Files
nebuleair_pro_4g/connexion.sh
2025-01-09 14:09:21 +01:00

29 lines
564 B
Bash
Executable File

#!/bin/bash
echo "-------"
echo "Start connexion shell script at $(date)"
#disable hotspot
echo "Disable Hotspot:"
sudo nmcli connection down Hotspot
sleep 10
echo "Start connection with:"
echo "SSID: $1"
echo "Password: $2"
sudo nmcli device wifi connect "$1" password "$2"
#check if connection is successfull
if [ $? -eq 0 ]; then
echo "Connection to $1 is successfull"
else
echo "Connection to $1 failed"
echo "Restarting hotspot..."
#enable hotspot
sudo nmcli connection up Hotspot
fi
echo "End connexion shell script"
echo "-------"