Tag Info

New answers tagged

3

Even more concise #!/bin/bash servers=( "1.1.1.1" "2.2.2.2" "3.3.3.3" "4.4.4.4" "5.5.5.5" "6.6.6.6" "7.7.7.7" ) for i in "${servers[@]}"; do ping -c 1 $i > /dev/null && /usr/bin/snmptrap -v 2c -c public ... done NOTES: The "&&" after ping means "IF TRUE THEN", and in the case of ping, TRUE means ping did not fail (i.e. the server ...


2

I've made some comments in line to explain what different parts of the script are doing. I've then made a concise version of the script below. #!/bin/bash servers=( "1.1.1.1" "2.2.2.2" "3.3.3.3" "4.4.4.4" "5.5.5.5" "6.6.6.6" "7.7.7.7" ) # As is, this bit doesn't do anything. It just pings each server one time # but doesn't save the output for i in ...



Top 50 recent answers are included