Reputation: 11
from netmiko import ConnectHandler
ip_num=['192.168.0.101','192.168.0.102','192.168.0.103']
for i in ip_num: pi4 = { 'device_type':'linux', 'ip' : i, 'username' : 'pi', 'password' : '12345678', 'secret' : 'True', 'port' : '22' } net_connect = ConnectionHandler(**pi4) net_connect.enable() net_connect.send_command("sudo reboot") net_connect.disconnect()
this is my code. The first pi 4 reboots fine. After that I get a readtimeout error. I also want the next 2 devices to reboot.
Upvotes: 0
Views: 141
Reputation: 200
Without traceback it is hard to be sure, but most likely send_command
cannot verify the execution of the command. Try send_command("sudo reboot", cmd_verify=False)
.
https://ktbyers.github.io/netmiko/docs/netmiko/index.html
Upvotes: 0