update
This commit is contained in:
@@ -8,25 +8,11 @@
|
||||
OUTPUT_FILE="/var/www/moduleair_pro_4g/wifi_list.csv"
|
||||
JSON_FILE="/var/www/moduleair_pro_4g/config.json"
|
||||
|
||||
|
||||
|
||||
echo "-------------------"
|
||||
echo "-------------------"
|
||||
|
||||
echo "NebuleAir pro started at $(date)"
|
||||
|
||||
# Blink GPIO 23 and 24 five times
|
||||
for i in {1..5}; do
|
||||
# Turn GPIO 23 and 24 ON
|
||||
gpioset gpiochip0 23=1 24=1
|
||||
#echo "LEDs ON"
|
||||
sleep 1
|
||||
|
||||
# Turn GPIO 23 and 24 OFF
|
||||
gpioset gpiochip0 23=0 24=0
|
||||
#echo "LEDs OFF"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "getting SARA R4 serial number"
|
||||
# Get the last 8 characters of the serial number and write to text file
|
||||
@@ -34,6 +20,7 @@ serial_number=$(cat /proc/cpuinfo | grep Serial | awk '{print substr($3, length(
|
||||
# Define the JSON file path
|
||||
# Use jq to update the "deviceID" in the JSON file
|
||||
jq --arg serial_number "$serial_number" '.deviceID = $serial_number' "$JSON_FILE" > temp.json && mv temp.json "$JSON_FILE"
|
||||
|
||||
echo "id: $serial_number"
|
||||
#get the SSH port for tunneling
|
||||
SSH_TUNNEL_PORT=$(jq -r '.sshTunnel_port' "$JSON_FILE")
|
||||
@@ -59,7 +46,7 @@ if [ "$STATE" == "30 (disconnected)" ]; then
|
||||
|
||||
|
||||
else
|
||||
echo "Success: wlan0 is connected!"
|
||||
echo "🛜Success: wlan0 is connected!🛜"
|
||||
CONN_SSID=$(nmcli -g GENERAL.CONNECTION device show wlan0)
|
||||
echo "Connection: $CONN_SSID"
|
||||
|
||||
@@ -69,27 +56,27 @@ else
|
||||
sudo chmod 777 "$JSON_FILE"
|
||||
|
||||
# Lancer le tunnel SSH
|
||||
echo "Démarrage du tunnel SSH sur le port $SSH_TUNNEL_PORT..."
|
||||
#echo "Démarrage du tunnel SSH sur le port $SSH_TUNNEL_PORT..."
|
||||
# Start the SSH agent if it's not already running
|
||||
eval "$(ssh-agent -s)"
|
||||
#eval "$(ssh-agent -s)"
|
||||
# Add your SSH private key
|
||||
ssh-add /home/airlab/.ssh/id_rsa
|
||||
#ssh-add /home/airlab/.ssh/id_rsa
|
||||
#connections details
|
||||
REMOTE_USER="airlab_server1" # Remplacez par votre nom d'utilisateur distant
|
||||
REMOTE_SERVER="aircarto.fr" # Remplacez par l'adresse de votre serveur
|
||||
LOCAL_PORT=22 # Port local à rediriger
|
||||
MONITOR_PORT=0 # Désactive la surveillance de connexion autossh
|
||||
#REMOTE_USER="airlab_server1" # Remplacez par votre nom d'utilisateur distant
|
||||
#REMOTE_SERVER="aircarto.fr" # Remplacez par l'adresse de votre serveur
|
||||
#LOCAL_PORT=22 # Port local à rediriger
|
||||
#MONITOR_PORT=0 # Désactive la surveillance de connexion autossh
|
||||
|
||||
#autossh -M "$MONITOR_PORT" -f -N -R "$SSH_TUNNEL_PORT:localhost:$LOCAL_PORT" "$REMOTE_USER@$REMOTE_SERVER" -p 50221
|
||||
# ssh -f -N -R 52221:localhost:22 -p 50221 airlab_server1@aircarto.fr
|
||||
ssh -i /var/www/.ssh/id_rsa -f -N -R "$SSH_TUNNEL_PORT:localhost:$LOCAL_PORT" -p 50221 -o StrictHostKeyChecking=no "$REMOTE_USER@$REMOTE_SERVER"
|
||||
#ssh -i /var/www/.ssh/id_rsa -f -N -R "$SSH_TUNNEL_PORT:localhost:$LOCAL_PORT" -p 50221 -o StrictHostKeyChecking=no "$REMOTE_USER@$REMOTE_SERVER"
|
||||
|
||||
#Check if the tunnel was created successfully
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Tunnel started successfully!"
|
||||
else
|
||||
echo "Error: Unable to start the tunnel!"
|
||||
exit 1
|
||||
fi
|
||||
#if [ $? -eq 0 ]; then
|
||||
# echo "Tunnel started successfully!"
|
||||
#else
|
||||
# echo "Error: Unable to start the tunnel!"
|
||||
# exit 1
|
||||
#fi
|
||||
fi
|
||||
echo "-------------------"
|
||||
|
||||
Reference in New Issue
Block a user