OmniCube Reference Manualrestart_windows_server(8)

restart_windows_server(8)

System Administration Commands · OmniCube · August 10, 2026

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:

1.

Attach to the zone console with zlogin -e '#' -C zone. When the caller is already root (id -u returns 0) the plain zlogin is spawned; otherwise it is spawned through pfexec.

2.

Send a carriage return, which is what makes SAC print its prompt.

3.

Wait for the string SAC> and send restart.

4.

Send the console escape sequence #. to detach, leaving the guest to reboot on its own.

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

zone

Name of the zone hosting the Windows guest. Required, and taken from the first argument only; further arguments are ignored. The name is not validated and is passed to zlogin as given, so an empty or wrong name simply produces a failed zlogin.

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.

0

The conversation ran to its end. Note that this says nothing about whether the guest accepted the restart command.

1

expect itself failed, for example because the console could not be spawned.

FILES

/opt/omnicube/sbin/restart_windows_server

This command.

/opt/ooce/bin/expect

The interpreter named in the script's interpreter line; the command cannot run without it.

/etc/security/exec_attr.d/omnicube

Grants the OmniCube Administration profile uid=0 execution of /usr/sbin/zlogin (and of /opt/ooce/bin/expect itself).

ENVIRONMENT

PATH

Inherited, not reset: unlike most of the suite, this script sets no PATH of its own, and expect resolves the spawned zlogin and pfexec through it. It must therefore contain /usr/sbin and /usr/bin. Only /usr/bin/id is called by absolute path.

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.

man8/restart_windows_server.8generated 2026-09-02 05:17 CEST