title: Bash poweroff script hangs system
body: <p>My intention is to cycle through my list of ips and poweroff if my ping succeeds first. However the systems seems to hang.   After running this script I  can't ping the systems anymore and they aren't powered off.  If I run <code>ssh 192.168.1.ip "sudo poweroff"</code> through terminal I dont encounter this issue. Any advice?</p>
  
  <pre><code>for ((ip=40, cnt=0; ip&lt;=max; ip++, cnt++))
  do
      if ping -c 1 192.168.1.$ip &amp;&gt; /dev/null
      then
          printf "\n${array[$cnt]}: Ping Successful"
          ssh 192.168.1.$ip "sudo poweroff"
          printf "\n${array[$cnt]}: Power Down Executed\n"
          sleep 1
      else
          printf "\n${array[$cnt]}: Ping Failed\n"    
      fi
  done
  </code></pre>
  
  <p>After running a single <code>ssh 192.168.1.40 "sudo poweroff"</code> the system is properly powered off. When running my script, I am unable to ping the systems however I can visually see the fans and leds are still on.   I think I should use a KVM to take a closer look since ssh doesn't allow allow connection after this script is run.  Still at first glance I dont understand how running <code>ssh 192.168.1.40 "sudo poweroff"</code> and running it through my script really makes a difference.  Anyways I'll try to add more information tomorrow.</p>