Commit 1f5419ae authored by Robert Ricci's avatar Robert Ricci
Browse files

Add newnode_reboot, which is used on nodes that aren't fully in the

database yet, so using node_reboot on them would be catastrophic.
Uses the special newnode MFS's ssh key.

Also, when a node has booted or the first time, it may be up on a
temporary IP address rather than its permanent one, so we pass the
node's IP rather than node_id on the command line.

Only tries ssh.
parent 579c4b09
......@@ -29,7 +29,8 @@ SBIN_STUFF = resetvlans console_setup.proxy sched_reload named_setup \
console_reset db2ns bwconfig frisbeelauncher \
rmgroup mkgroup setgroups mkproj \
exports_setup.proxy vnode_setup eventsys_start \
sfskey_update sfskey_update.proxy rmuser idleswap
sfskey_update sfskey_update.proxy rmuser idleswap \
LIBEXEC_STUFF = rmproj wanlinksolve wanlinkinfo \
os_setup mkexpdir console_setup webnscheck webreport \
......@@ -119,6 +120,8 @@ post-install:
chmod u+s $(INSTALL_LIBEXECDIR)/spewlogfile
chown root $(INSTALL_BINDIR)/node_reboot
chmod u+s $(INSTALL_BINDIR)/node_reboot
chown root $(INSTALL_SBINDIR)/newnode_reboot
chmod u+s $(INSTALL_SBINDIR)/newnode_reboot
chown root $(INSTALL_BINDIR)/node_update
chmod u+s $(INSTALL_BINDIR)/node_update
chown root $(INSTALL_SBINDIR)/vnode_setup
#!/usr/bin/perl -wT
# Copyright (c) 2003 University of Utah and the Flux Group.
# All rights reserved.
# Script to reboot nodes that are not yet in the database - overlaps a bit with
# node_reboot, but can't make any assumptions about the node (given as an IP
# address) being in the database, no event system, etc.
use English;
use lib '@prefix@/lib';
use libdb;
my $TB = "@prefix@";
# Ack! Using sshtb gives all kinds of problems, so we have to duplicate a lot
# of stuff it does.
my $SSH_ARGS = '@SSH_ARGS@';
my $ssh = "/usr/bin/ssh -n $SSH_ARGS";
# Scrub PATH
$ENV{PATH} = "/bin";
# We use a different private key so that we can have a single MFS for this that
# works at every site
my $privkey = "$TB/etc/identity.newnode";
if (!TBAdmin($UID)) {
die "Sorry, only admins can run this script\n";
# XXX - Check to see if the node we're sshing into is the one we think it is?
if (@ARGV != 1) {
die "usage: $0 <IP>\n";
# Check IP
my $IP;
if ($ARGV[0] !~ /^(\d+\.\d+\.\d+\.\d+)$/) {
die "Invalid IP address\n";
} else {
$IP = $1;
my $rv = system("$ssh -l root -i $privkey $IP /sbin/reboot");
# XXX - We can't check the return value of ssh for failure, since reboot on
# FreeBSD seems to always return non-zero.
exit $rv;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment