#!/bin/rc
# R - reboot system via console
rfork en
fn usage {
echo >[1=2] usage: R system
exit usage
}
if(~ $#* 0)
usage
if(! test -e /mnt/consoles/$1){
server=`{ndb/query sys $1 console}
if(~ $server ''){
echo >[1=2] R: unknown console server for $1
exit noserver
}
switch($sysname){
case $server
mount /srv/consoles /mnt/consoles
case *
import $server /mnt/consoles
}
}
# we might be in rdb; send break
if(test -f /mnt/consoles/$1^ctl)
echo k >/mnt/consoles/$1^ctl
tt '^T^Tr' >/mnt/consoles/$1
|