forked from OCT-FPGA/oct-u280
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcold-reboot.pl
executable file
·43 lines (36 loc) · 966 Bytes
/
cold-reboot.pl
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
37
38
39
40
41
42
43
#!/usr/bin/perl -w
# Drag in path stuff so we can find emulab stuff.
BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
my $HOME = $ENV{"HOME"};
#
# HOME will not be defined until new images are built.
#
if (!defined($HOME)) {
$HOME = "/users/geniuser";
$ENV{"HOME"} = $HOME;
$ENV{"USER"} = "geniuser";
}
my $GENIGET = "/usr/bin/geni-get";
my $REBOOT = "/usr/local/bin/node_reboot";
my $nodeID = `cat $BOOTDIR/nodeid`;
if ($?) {
fatal("Could not get nodeID");
}
chomp($nodeID);
if (! -e "$HOME/.ssl/emulab.pem") {
if (! -e "$HOME/.ssl") {
if (!mkdir("$HOME/.ssl", 0750)) {
die("Could not mkdir $HOME/.ssl: $!");
}
}
system("$GENIGET rpccert > $HOME/.ssl/emulab.pem");
if ($?) {
die("Could not geni-get xmlrpc cert/key");
}
}
print "Going to cold reboot";
#system("$REBOOT -s $nodeID");
system("$REBOOT --server=boss -s $nodeID");
sleep(15);
# Still here? Bad.
die("Power cycle failed!");