NAME
restart_windows_server - reboot a Windows guest through its SAC console
SYNOPSIS
/opt/omnicube/sbin/restart_windows_server zone
DESCRIPTION
restart_windows_server reboots the Windows guest running in zone by driving the guest's Special Administration Console (SAC) over the zone console, rather than by halting the virtual machine from the host. The guest therefore performs an orderly shutdown of its own services before restarting.
It is an expect(1) script, run directly by /opt/ooce/bin/expect, and the whole conversation is four steps:
The pfexec test exists because pfexec adds no privilege when the caller is already root, while pfexec zlogin into an LX zone can emit pfexecd not running; pid NNNNN privileges not elevated on standard error, which expect would then mix into the console stream it is matching on. Being a Tcl script it cannot source /opt/omnicube/lib/common/utils.sh, so id -u stands in for the ${PFEXEC} test made there; for the same reason there is no run-level guard and no locking.
This command is meant to be run by hand, or from a script that already knows the guest is a Windows one. Nothing in the suite calls it automatically.
OPERANDS
USAGE
Example 1: reboot a Windows guest
pfexec /opt/omnicube/sbin/restart_windows_server win2022
Example 2: reboot, then wait for the guest agent to come back
/opt/omnicube/sbin/restart_windows_server win2022 sleep 60 /opt/omnicube/sbin/qemu-monitor-command -z win2022 -c ping
EXIT STATUS
The script sets no status of its own.
FILES
ENVIRONMENT
SECURITY
A non-root caller reaches the console through pfexec, which requires the root-equivalent OmniCube Administration profile; the restricted per-zone alternative is restrict-shell-cmd(8). The zone name is interpolated into the spawned command line without validation, so this command must not be exposed to untrusted callers or driven from unvalidated input.
SEE ALSO
omnicube_utils(3), omnicube(7), manage_zone.sh(8), qemu-monitor-command(8), restrict-shell-cmd(8), shutdown_windows_server(8).
NOTES
SAC must be enabled in the guest (Emergency Management Services on the serial port) and reachable on the console that zlogin -C attaches to. If the SAC> prompt never appears, the wait ends on the default expect timeout and the restart line is sent anyway, into whatever is listening - there is no timeout branch and no error is reported. A guest sitting at a login prompt instead of SAC is the common case for this.
SAC restart restarts the operating system without prompting logged-on users, and no confirmation is read back, so the command is fire-and-forget. Where the QEMU guest agent is installed and configured, qemu-monitor-command -z zone -c shutdown --arguments.mode reboot is the more observable route, since it reports whether the agent accepted the request.
The command detaches from the console immediately after sending restart; it does not wait for the guest to go down or come back up.