OmniCube Reference Manualzone_monitor.sh(8)

zone_monitor.sh(8)

System Administration Commands · OmniCube · August 10, 2026

NAME

zone_monitor.sh - boot OmniCube zones that are installed but not running

SYNOPSIS

/opt/omnicube/sbin/zone_monitor.sh

zone_monitor.sh

DESCRIPTION

zone_monitor.sh restarts zones that should be up but are not. It takes no options and no operands and is meant for unattended periodic execution from root's crontab, alongside the other periodic jobs whose sample entries are shipped in /opt/omnicube/share/README. It is also useful by hand after a node has come back from maintenance, to boot everything that is supposed to autoboot in one step.

The script does not set its own PATH, so the invoking environment must resolve svcs, svcprop, zoneadm, zonecfg, ps and pfexec. It sources /opt/omnicube/lib/common/utils.sh for logging and the run-level guard.

Global service gate

Before looking at any zone the script runs svcs -xv. If that produces any output at all, the global zone still has services in maintenance or offline, so the script logs System not cleaned yet: <svcs output> through info() and exits 0 without touching a single zone. Booting zones on a host whose own service graph has not settled would only compound the problem.

Run-level guard

abort_if_shutting_down is called before the service gate and again at the top of every zone iteration, so the script exits 0 silently when the host is at run level 0, 1, 5, 6, S or s, or when /etc/nologin exists, and a shutdown starting part way through stops it before the next zone is booted. OC_IGNORE_RUNLEVEL set to a non-empty value overrides the guard.

Locking

This command takes no lock and does not enforce single-instance execution. The ten-second pause after each boot is the only pacing. Sourcing utils.sh still creates and normalises /var/run/omnicube as a side effect.

Per-zone decision

Each zone reported by zoneadm list -ni is examined in turn, and is booted only if all of the following hold.

the zone is installed, not running

The state is read from the parsable, per-zone query zoneadm -z <zone> list -p and must be exactly installed. The parsable form is used deliberately: matching the zone name against the whole listing would let a dot in a zone name match sibling zones in the path or brand columns.

the zone is not administratively stopped

The property config/adm_status is read from the per-zone service instance svc:/service/omnicube/zone:<zone>. If that property does not exist, the zone's autoboot setting from zonecfg -z <zone> info autoboot is used instead. A value of false or stopped means the zone is meant to stay down and it is skipped.

no boot is already in flight

ps -eaf is searched for a zoneadm process whose argument list contains the zone name as a complete word. If one is found the script logs Zone <zone> is already booting and moves on. The whole-word test avoids matching a sibling zone whose name is a substring, and it works for a zone name that is the final argument.

A zone that passes all three is logged as Zone <zone> is stopped, starting it... and booted with pfexec zoneadm -z <zone> boot, after which the script sleeps ten seconds before considering the next zone.

Alerting

The script only ever calls info(), so every message goes to stdout and to syslog as user.info under the tag <site>zone_monitor, which /etc/rsyslog.d/omnicube.conf routes to /var/log/misc.log. It never calls warning() or error(), so it never sends oc-warn or oc-alert mail. A failing zoneadm boot is not diagnosed by the script: its own stderr is the only signal, which for a cron invocation means cron mail.

OPERANDS

This command takes no options and no operands. Any argument given is ignored.

SMF PROPERTIES

config/site

On svc:/omnicube/sysadm:default (or the instance named by OC_SMF_INSTANCE). Mandatory. Prefix for the syslog tag. If unset, sourcing utils.sh fails and the script exits 78.

config/adm_status

On the per-zone instance svc:/service/omnicube/zone:<zone>. Values false and stopped keep the zone down; any other value, including an absent property, allows the boot. When the property is absent, the zone's autoboot setting is consulted instead.

config/lock_group

On svc:/omnicube/sysadm:default. Group applied to /var/run/omnicube (mode 1775). Default sysadmin.

EXAMPLES

Example 1: five-minute cron entry

*/5 * * * * /opt/omnicube/sbin/zone_monitor.sh >/dev/null

Example 2: bring every autoboot zone up after maintenance

pfexec /opt/omnicube/sbin/zone_monitor.sh
zoneadm list -ni

Example 3: keep one zone permanently down

svccfg -s svc:/service/omnicube/zone:zn06efit \\
    setprop config/adm_status = astring: stopped
svcadm refresh svc:/service/omnicube/zone:zn06efit

EXIT STATUS

0

Normal completion. Also returned when svcs -xv reported unsettled services and no zone was examined, and silently when the run-level guard trips.

78

config/site is not set on svc:/omnicube/sysadm, so utils.sh refused to initialise.

No other status is produced deliberately. In particular, the exit status does not report whether a zone actually booted; the script does not check the result of zoneadm boot.

FILES

/opt/omnicube/lib/common/utils.sh

Shared shell library, sourced at start-up.

/var/run/omnicube

Lock base directory, created and normalised when utils.sh is sourced. This script creates no lock inside it.

/var/log/misc.log

Default destination of the syslog records.

/etc/nologin

Presence means a shutdown is in progress; the script exits 0.

ENVIRONMENT

OC_SMF_INSTANCE

Selects the svc:/omnicube/sysadm instance whose config properties are read. Unset means default.

OC_IGNORE_RUNLEVEL

When non-empty, bypasses the run-level guard.

PATH

Inherited, not set by the script.

SECURITY

Booting a zone requires pfexec, which needs the OmniCube Administration profile from /etc/security/prof_attr.d/omnicube and the /usr/sbin/zoneadm entry in /etc/security/exec_attr.d/omnicube. That profile is root-equivalent as a whole. Zone names come from zoneadm itself and are passed to ps through an awk variable rather than being interpolated into a regular expression.

SEE ALSO

manage_zone.sh(8), pool_monitor.sh(8), sys_monitor(8), zone_save.sh(8), zones_srv_monitor.sh(8), oc_log(3), oc_runlevel(3), omnicube_utils(3), omnicube(7).

NOTES

The global service gate makes this monitor all-or-nothing: one service in maintenance in the global zone stops every zone boot for as long as it lasts. Check svcs -xv first when zones are not coming up.

The script does not consult the isolation marker /var/run/omnicube/isolate_node.lock. On an isolated node the remote pools are offline, so a zone backed by them cannot boot and the attempt will be retried on every run. See isolate_node.sh(8).

Because there is no lock, two overlapping runs can both decide to boot the same zone. The ps check for an in-flight zoneadm narrows that window but does not close it.

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