-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreboot.py
More file actions
36 lines (25 loc) · 750 Bytes
/
reboot.py
File metadata and controls
36 lines (25 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#@author dposch
import os
import paramiko
import ssh_lib as ssh
import node_parser as np
MNG_PREFIX = "192.168.0."
EMU_PREFIX = "192.168.1."
ITEC_GATEWAY = "10.0.0.1" # todo change this once router is setup
PI_START_SUFFIX = 10
PI_END_SUFFIX = 29
print "Deploying Code:"
# available pis: PREFIX.NR = IP
pi_list = range(PI_START_SUFFIX,PI_END_SUFFIX+1) # returns [start, ..., end-1]
print "Available PIs(" + str(len(pi_list)) + "): " + str(pi_list)
commands = {}
for i in pi_list:
commands[MNG_PREFIX+str(i)] = []
#change into ndn folder
commands[MNG_PREFIX+str(i)].append("reboot")
for pi in commands:
print "Rebooting Pi: " + pi
s = ssh.Connection(pi, 'root', password = 'pi')
s.execute("reboot")
s.close()
print "Pis Rebooted!\n"