basically, with a c-style for loop:
Code:
## the snmp stuff
If=( InOctets OutOctets Mtu OperStatus LastChange )
Of=( in out mtu status change )
for (( i=1; i<=24; i++ ))
do
for item in ${If[@]}
do
snmpget -v 1 xx.xx.xx.xx -c public if${If[item]}.$i | cut -b34-70 > \
/var/www/html/stats/${i}.${Of[ind++]}
done
unset ind
done
chmod 755 /var/www/html/stats/{1..24}.{in,out,mtu,status,change}
## the sql stuff
for file in /var/www/html/stats/{1..24}.{in,out,mtu,status,change}
do
while read line
do
# something like that:
mysql -u User -h Host -D Database -p Pass \
-e 'INSERT INTO TABLE your_Table (column) VALUES('"$i"')'
done < $file
done