pfsense wan up down shell sh
-
#!/bin/bash
pfctl -si > /etc/si.log
percentage=$(grep "current entries" /etc/si.log | awk '{print $NF}')
total=100
threshold=70
result=$(echo "scale=4; $percentage * $total / 801000" | bc)
result_int=$(echo $result | cut -d'.' -f1)
if [ $result_int -ge $threshold ]; then
sudo ifconfig igb0 down
echo "Current usage is $result%. Taking action..."
else
echo "Current usage is $result%. No action needed."
fi26: Syntax error: end of file unexpected (expecting "then")
An error occurs. Can you tell me where the problem occurred?