Fix variable name

This commit is contained in:
2023-05-18 21:58:08 +02:00
parent 8b3a8885ee
commit df8788ed95

View File

@@ -69,14 +69,14 @@ do
if [ $next_seconds -lt 0 ]
then
if [ -n "$webhook_url" ]; then
if [ -n "$webhook" ]; then
send_webhook "ERROR: Schedules are not setup correctly!"
fi
echo 'schedule error, exiting...'
exit
fi
if [ -n "$webhook_url" ]; then
if [ -n "$webhook" ]; then
send_webhook "Next schedule: $next_time"
fi
@@ -92,7 +92,7 @@ do
next_vpn_index=$(( $next_index + 1 ))
vpn=$(echo "$vpns" | sed -n "${next_vpn_index}p")
echo "VPN: [$next_vpn_index] - $vpn"
if [ -n "$webhook_url" ]; then
if [ -n "$webhook" ]; then
send_webhook "Switching to VPN: [$next_vpn_index] - $vpn"
fi
@@ -111,7 +111,7 @@ do
then
echo "VPN connection successfully established"
echo "Starting script..."
if [ -n "$webhook_url" ]; then
if [ -n "$webhook" ]; then
send_webhook "VPN connection successfully established.\nStarting script..."
fi
if [ -f "./Microsoft-Rewards-bot/$vpn.json" ]
@@ -135,7 +135,7 @@ do
break
else
echo "File ./Microsoft-Rewards-bot/$vpn.json does not exist, skipping starting bot for this VPN"
if [ -n "$webhook_url" ]; then
if [ -n "$webhook" ]; then
send_webhook "ERROR: File ./Microsoft-Rewards-bot/$vpn.json does not exist, skipping starting bot for this VPN"
fi
read -t 3
@@ -143,13 +143,13 @@ do
fi
else
echo "Failed to establish VPN connection (attempt $attempt of $retries)"
if [ -n "$webhook_url" ]; then
if [ -n "$webhook" ]; then
send_webhook "ERROR: Failed to establish VPN connection (attempt $attempt of $retries)"
fi
if [ $attempt -eq $retries ]
then
echo "Max retries reached, switching to the next schedule"
if [ -n "$webhook_url" ]; then
if [ -n "$webhook" ]; then
send_webhook "ERROR: Max retries reached, switching to the next schedule"
fi
fi
@@ -159,7 +159,7 @@ do
done
else
echo "ERROR: VPN name is empty"
if [ -n "$webhook_url" ]; then
if [ -n "$webhook" ]; then
send_webhook "ERROR: VPN name is empty"
fi
fi