This commit is contained in:
Your Name
2025-02-21 11:02:21 +01:00
parent cf9e373ea8
commit 105e439199
17 changed files with 477 additions and 12 deletions

32
connexion.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
#script started by the user via the web interface
#$1 and $2 are SSID and Password (arguments passed via the php script launcher.php)
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 "-------"