| NEX(1) | NEX Commands | NEX(1) |
NAME
nex, nxps, nxtop, nxfree, nxdf, nxnodes, nxcpu, nxnet, nxss - the NEX cluster seen and used as a single computer
SYNOPSIS
nex ps [--local] [--json] [--kernel]
nex nodes [--json]
nex top [-d SECONDS] [-n TIMES] [-b]
[--node NODE] [--sort cpu|mem|time]
nex free | nex df | nex cpu [-a] | nex net
[-a] | nex ss [-l] [-t|-u] | nex ss
--cluster [--json]
nex port allow PORT[/udp] [--users
USER[,USER...]] [--groups
GROUP[,GROUP...]] | clear PORT[/udp] |
rules [--json]
nex run [--node NODE|any] [-n]
[-t|-T] [--cpu PCT] [--mem SIZE]
[--env K=V]... [--image IMAGE]
[-X|--x11-auto] [-W|--wayland-auto]
[-A|--audio-auto] [-d [-q]] [-a]
[-v] -- COMMAND [ARG...]
nex jobs | nex attach [NODE:]JOB | nex stop
[NODE:]JOB
nex devices [--json]
nex submit [-p 0-9] [-q] [--node
NODE] [--cpu PCT] [--mem SIZE]
[--env K=V]... [--image IMAGE] --
COMMAND [ARG...]
nex queue | nex cancel ENTRY...
nex cron add NAME 'SCHEDULE' [--node
N] [--cpu PCT] [--mem SIZE] [--env
K=V]... [--image IMAGE] -- COMMAND
[ARG...] | list [--json] | run NAME |
activate CODE | remove NAME
nex alarm [[list] [--json] | config | ack
ID | set KEY VALUE | test]
nex snapshot [list] [PATH] | create [--name
NAME] [PATH] | remove NAME [PATH] |
restore PATH [--from NAME] [--overwrite]
| config | set KEY VALUE | purge DIR
nex backup [status | key | run | set KEY
VALUE]
nex token [list | create NAME [--read-only]
[--days N] | revoke NAME]
nex image [list | pull NAME | remove
NAME | registries [LIST]]
nex acct [--from YYYY-MM-DD] [--to
YYYY-MM-DD] [--user U] [--json]
nex audit [--since 2h|YYYY-MM-DD] [--until
...] [--user U] [--type PREFIX]
[-n N] [--json]
nex license [status] [--json] | activate
CODE | trial | import FILE | remove |
request
nex apt status [--nodes A,B] [--json]
nex apt update | install PACKAGE... | activate
CODE | upgrade [--reboot] [--nodes A,B]
[--timeout S] [--dry-run]
nex report [-o FILE] [--since 24h]
nex lock [--nowait | --timeout S] NAME
-- COMMAND [ARG...] | nex lock list
nex kv get|set|del|list [KEY]
[VALUE] [--ttl D] [--if-absent | --expect
V] [--group G | --cluster]
nex secret set|get|list|rm [NAME]
nex pub TOPIC MESSAGE
nex sub TOPIC [--history N] [--count
N] [--timeout S]
nex mq push|pop|len QUEUE [MESSAGE]
[--wait S]
nex vip add NAME IP[/PREFIX] [--service
SVC] [--nodes N1,N2] [--interface IF]
[--port P] [--publish P,...]
[--proxy-protocol] | list [--json] | remove
NAME
nex service apply FILE|- | list
[NAME] [--json] | endpoints NAME |
activate CODE | restart NAME | remove
NAME | drain NODE | undrain NODE
nex make|ninja [-j N] [--ccache]
[--local] [-v] [--] [ARG...]
nex history [--node NODE] [--since 6h]
[--what cpu,mem,net,load,disk,storage] [--json]
nex logs [-n LINES] [--node NODE]
[-u UNIT|--job NODE:JOB] [-p
PRIO] [-g TEXT] [--since DURATION]
[-f]
nex forward [-R] [--node NODE]
[BIND:]PORT:HOST:PORT
nex kill [-SIGNAL] [NODE:]PID... | activate
CODE | nex wait [-t SECONDS]
[NODE:]PID...
nex msg USER TEXT | nex wall TEXT | nex
passwd | nex quota | activate CODE | nex
version | nex --version
DESCRIPTION
nex talks to the agent of the local node (nexagentd(8)) through /run/nex/agent.sock; the agent queries the other nodes and forwards the jobs. A user sees and controls only their own processes and jobs, root all of them. The short names nxps, nxtop, nxfree, nxdf, nxnodes, nxcpu, nxnet and nxss are the same as nex ps, nex top, and so on.
Observing
- ps
- processes of the whole cluster (--local only those of this node).
- nodes
- nodes: reachable, compute role, mount, load, CPU, free memory, jobs.
- top
- like top(1) for the whole cluster, refreshed every 2 seconds (q quits, k stops a process, -b plain text for programs).
- free, df, cpu, net, ss
- memory, space on the shared filesystem and disks, processors, networks, traffic, TCP and UDP sockets with the process that uses them.
- ss --cluster
- the cluster ports: a program listening on nex:PORT (127.77.0.1, also cluster; over IPv6 fd6e:6578::1, nex6) on any node is reachable at the same address from every node; this shows the node that holds each port and the user.
- port allow | clear | rules
- who may connect to a cluster port. Without a rule, every user of the nodes; with allow only root, the user listening on the port, the users of --users and the members of the groups of --groups. The user listening on the port, or root, sets and clears it; it applies on every node within a few seconds, also to the programs on the node of the service (with nftables). A rule set by a user no longer counts if the port passes to another user. rules lists the rules.
- logs
- the systemd journal of all nodes, merged in time order: -n last lines (30), -p highest priority (err, warning, ... or 0-7), -g text to search for (in the last 24 hours without --since), --since 45s, 30m, 2h, 3d, -f follows new entries, --job the entries of a detached job.
- history
- history of the measurements: CPU, memory, network (and, with --what, load and disk) of each node over time, as rows of blocks as wide as the terminal, with minimum, average and maximum. --since 30m, 6h (default), 2d, up to 30 days; --node a single node; --what cpu,mem,net,load,disk,storage (the NEXFS storage of the cluster: space used, reads, writes, blocks with missing copies); --json the raw agent answer. Each agent saves one sample per minute in the NEXFS control store, where it stays for 30 days; a node that cannot reach the store sends the sample to another node, which saves it on its behalf. A gap in a row is a period without samples.
Running
- run
- runs COMMAND on NODE (this one if missing; any the least loaded) in the same directory, which must be on the shared filesystem, with stdin, stdout, stderr and signals forwarded; the exit code is that of the command (128+signal if killed, 255 for a NEX error). -t forces an interactive terminal, -T disables it, -n no stdin, --cpu 50 half a CPU, --mem 512M maximum memory, --image IMAGE in a rootless Podman container with an image from the cluster archive (nex image list), as the user, with /nex, the current directory and the node's network (also with -d, submit and cron add), -X X11 graphics forwarding (--x11-auto: only if the DISPLAY screen answers, otherwise without graphics), -W Wayland graphics forwarding (waypipe, on the user's node and on the job's node) (--wayland-auto: only if a Wayland session is reachable, otherwise without; nexsh uses both automatic options), -A audio forwarding: the program plays and records through the PulseAudio (or pipewire-pulse) of the user's node (--audio-auto: only if an audio server is reachable), -a prints the chosen node, -v node and systemd unit.
- run -d
- detached job: keeps running after you log out and prints NODE:JOB; the output is kept (up to 1 MiB) for attach; at the end a notice reaches the user's terminals (-q no notice).
- jobs
- detached jobs of the whole cluster.
- devices
- devices exported by the nodes (lines of /etc/nex/devnodes.conf), usable on every node as /devnodes/NODE/dev/NAME (Unix sockets as /devnodes/NODE/sock/NAME); for each: status (ready, socket, absent) and whether the user can use it.
- attach
- attaches to a detached job again: first the saved output, then the new output. Ctrl-] (with a terminal) or Ctrl-C (without) detach without stopping it.
- stop
- stops a detached job.
- submit
- puts the job in the queue: it starts as a detached job when a compute node has free CPUs according to the --cpu reservations (default one CPU); -p priority from 0 to 9 (default 5).
- queue, cancel
- the queue (position, node:job, result) and the cancellation of waiting entries.
- make, ninja
- distributed build: runs make(1) or ninja(1) with the compilations (cc -c, g++ -c, ...) on the compute nodes, when sources and objects are on /nex. One worker per compute node receives the files as it has free slots; linking and preprocessing stay on this node; the files of a node that fails are compiled again here. -j parallel compilations (default: CPUs of the compute nodes plus two), --ccache looks in the ccache cache of this node first and sends to the other nodes only what is missing, --local everything on this node, -v workers and compilations per node. The Makefile must call the compiler by name (cc, gcc, g++, c++, clang, clang++).
- service (svc)
- cluster services, programs to keep running. apply reads a JSON definition (object or array; see servizi.md): command, directory in /nex, replicas on distinct nodes, health check (tcp, http, cmd), restarts with increasing delay; a changed definition is applied one instance at a time. list shows instances, node:job, status, restarts, leader and nodes; endpoints the node:port addresses of the healthy instances; restart restarts one instance at a time; remove removes the service. drain and undrain (root) move the services off a node without interruption and make it available again. Users manage their own services, root all of them; services never run as root.
- cron
- scheduled tasks of the cluster. add NAME 'SCHEDULE' [--node N] [--cpu PCT] [--mem SIZE] [--env K=V] -- COMMAND defines one (five fields as in crontab, or @hourly @daily @weekly @monthly @yearly; local time of the nodes; current directory in /nex); list, run NAME, remove NAME. Each run starts only once, on a node with a free CPU, as an entry of the queue (nex queue); the services leader decides it; a run is skipped if the previous one is still in progress.
- alarm
- cluster alarms: nodes that do not answer (node:NODE), full disks and /nex (disk:NODE:MOUNT, nexfs), memory (mem:NODE), health of the NEXFS storage (storage, from nexfsctl health) and a failed backup (backup), checked by the services leader every 30 seconds. list (default) shows the active alarms and the latest events, with --json as JSON (nex alarm --json is the same as nex alarm list --json); config thresholds and recipients. Root only: ack ID acknowledges an alarm, set KEY VALUE changes a threshold (disk_warn, disk_crit, mem_warn, mem_crit, node_down_s, hysteresis, repeat) or a recipient (notify_users, email_to, email_from), test raises a test alarm to check the notifications (terminals, email through sendmail, /etc/nex/alarm-notify). nex alarm list exits with 0 without alarms, 3 with warnings only, 4 with at least one critical alarm.
- snapshot
- NEXFS snapshots of the protected directories (home and project directories): one every hour, taken by the services leader, keeping 24 hourly, 14 daily and 8 weekly, read-only in DIR/.snap/. list (default) shows the snapshots of the directory that contains PATH and, for a file, which snapshots contain it; restore copies it back from the most recent snapshot that contains it (or from --from), next to the original as FILE.restored-NAME if the original still exists, in its place with --overwrite; create takes a manual snapshot man-DATE[-NAME] (the owner on their own directory, at most user_max per directory), remove removes it, config shows the rules and which directories are protected (any user). Root only: set (hourly, daily, weekly, user_max, dirs), purge DIR removes all snapshots, to be done before deleting the directory (NEXFS does not remove a directory that has snapshots).
- backup
- (root) optional copy of the protected directories to another server with rsync over SSH, each full copy in PATH/YYYY-MM-DD_HHMM/ with hard links to the previous one. key creates and shows the public key to authorize on the server; set backup_target USER@HOST:/PATH (empty = off), backup_when (as in nex cron, default 30 1 * * *), backup_keep (7); run now; status exits with 3 if the last backup failed.
- token
- tokens for the HTTP/JSON API of nex-dashd(8) (https://NODE:7443/api/v1/..., header Authorization: Bearer). create NAME prints the secret only once on stdout (save it in a file readable only by the owner); it expires after 90 days or --days N (at most 365); --read-only allows reads only. The token has the permissions of the user who creates it. list shows your own tokens (root: all), revoke revokes one at once (root also USER/NAME).
- image
- container images in the cluster archive (/nex/.nex-images), used by nex run --image. list (default) shows them with the allowed registries. Root only: pull NAME downloads an image by its full name (docker.io/library/debian:13) from an allowed registry, remove removes it, registries LIST changes the allowed registries (comma separated).
- acct
- usage per user in the period (default: from the first of the month to today): CPU hours of jobs (measured by systemd at job end) and of interactive sessions, number of jobs, memory peak, space of the home and of the project directories (measured every day). A user sees their own data, root everyone's (--user for one user only).
- audit
- audit log: start and end of every job (node, command, directory, origin: run, run -d, queue, cron, service; exit code, duration, CPU, memory) and actions on services, cron, images, tokens, snapshots, backups, alarms. Default: last 24 hours; --since accepts 45s, 30m, 2h, 3d or a date; --type a prefix (job.start, job.end, snapshot., ...). A user sees their own events, root all of them.
- apt status | apt update | apt install PACKAGE... | apt upgrade [--reboot]
- (root) APT on the whole cluster, through nexctl apt. status shows for every node the pending updates, how many are security updates, whether it asks for a reboot and the age of the package lists (--json for the JSON); update runs apt-get update on every node at the same time; install installs the same packages on every compute node (or the nodes of --nodes); upgrade upgrades the whole system one node at a time: drain, upgrade, reboot of the nodes that need it with --reboot, undrain, NEXFS whole again before the next node. Details in nexctl(8).
- license [status] [--json] | license trial | license import FILE | license remove | license request
- the edition of the cluster and its node limit. Every machine counts, whatever its role: Free allows up to 4 nodes without a license and without registration; a 30-day trial (once per cluster) and the Base (32 nodes) and Enterprise (128 nodes, with the paid modules) licenses raise the limit. status (for everyone) shows edition, nodes in use, expiry and modules; trial, import (the license file downloaded from the NEX website) and remove are for root and go through nexfsctl license, because NEX and NEXFS share one license; request prints the request to upload on the website for a cluster without Internet (the page /attiva gives back the license file to import). activate (root) sends the activation code received from Arato Ingegneria to the license server and installs the license; after that the services leader renews it every 7 days, as long as the yearly fee is paid. The server is https://nex.aratoingegneria.it, or the first line of /etc/nex/license-server. When the limit is reached only new nodes are refused; the nodes already in the cluster keep working, and the alarm license says so. report [-o FILE] [--since 24h] writes nex-report-NODE-DATE.tar.gz (mode 0600; with sudo it belongs to the user who asked) to attach to a problem report: versions of programs, packages and kernel, state of nodes, compute role, NEXFS, services, virtual addresses, alarms, queue, space and pending updates, warnings and errors of all nodes and the logs of the agent and of NEXFS since --since (45m, 24h, 3d or a date), the configuration of this node, subject and expiry of the certificates. Never private keys, the block key, the nex secret key, tokens or passwords: only configuration files readable by everyone, with the values of fields named like key, secret, password or token replaced by "(hidden)". As a user the report is reduced (own logs only); root gets the complete one. It prints the name of the archive.
- lock
- [--nowait | --timeout S] NAME -- COMMAND runs the command only while holding the lock NAME across the whole cluster (names per user), released at the end. 15 s lease renewed by the agent: if it is not renewed for 10 s (isolated node) the command is stopped before the lock passes to another node; if nex dies, the command dies too. Environment: NEX_LOCK_NAME, NEX_LOCK_NODE, NEX_LOCK_TOKEN (increasing fencing token). Exit: that of the command, 75 lock busy or wait timed out, 76 lock lost. lock list shows the locks held.
- kv get KEY | kv set KEY VALUE|- [--ttl 10m] [--if-absent | --expect V] | kv del KEY | kv list [PREFIX] [--json]
- cluster key-value store: text values up to 64 KiB, the same from every node (in the NEXFS control store). Personal space by default, --group NAME the space of a group (members read and write), --cluster the space shared by everyone (only root writes). Keys of 1-200 bytes; - reads the value from stdin; --ttl in seconds or with s, m, h, d. --if-absent writes only if the key does not exist, --expect only if it still has that value: atomic across all nodes. Exit: 0, 1 key missing or error, 2 wrong usage, 3 someone else wrote first.
- secret set NAME | secret get NAME | secret list [--json] | secret rm NAME
- secrets of your own user (passwords, tokens, keys), from any node, encrypted with the cluster key (AES-256-GCM; in the control store only the ciphertext, in the audit log only the name). set reads the value from the terminal (twice, no echo) or stdin, not from arguments; get writes it to stdout (PW=$(nex secret get db)); list shows the names. Names: 1-128 characters from letters, digits and . _ - / @; values up to 64 KiB. Exit 1 if the secret is missing.
- pub TOPIC MESSAGE|- | sub TOPIC [--history N] [--count N] [--timeout S] [--json]
- messages between processes on different nodes: pub delivers it to all subscribers of the topic and reports how many received it; sub keeps listening and prints one line per message (with --json the envelope: message, user, node, time), first the last N of the history (it keeps 100); it stops after --count messages or --timeout seconds.
- mq push QUEUE MESSAGE|- | mq pop QUEUE [--wait S] | mq len QUEUE
- message queue: each message is taken by a single pop, even with many consumers on different nodes; --wait waits up to S seconds (at most 300) if the queue is empty. Exit 1 if the queue stays empty. For pub, sub and mq the spaces are those of kv.
- vip
- virtual addresses (root only for add and remove): add NAME IP[/PREFIX] [--service SVC] [--nodes N1,N2] [--interface IF] [--port P] [--publish P,...] [--proxy-protocol] puts the address on a live compute node (with --service, where an instance of the service is healthy; with --port, where port P answers, e.g. 445 for Samba) and moves it with gratuitous ARP; with --publish it offers the cluster ports nex:P to the outside, wherever the service runs (with --proxy-protocol the service receives the real address of the client, PROXY v1); list shows who holds it; remove removes it. Every node lists in /etc/hosts the names NODE.nex and NAME.nex.
- forward
- like ssh -L: the local port leads to HOST:PORT as seen from NODE (localhost is the node itself); BIND default 127.0.0.1. With -R, like ssh -R: the port opens on NODE (on behalf of the user) and leads to HOST:PORT as seen from this node; Ctrl-C closes it on the other side too.
Between sessions
- kill, wait
- sends a signal to a process on any node and waits for it to end.
- msg, wall
- message to the terminals of a user on all nodes, or to everyone (root).
Your account
- passwd
- changes the cluster user password on all nodes.
- quota
- used space and quota of the home, CPU and memory limits per node.
- version | --version
- --version prints the version of nex, the same as the nex-cluster package; version also asks the local agent for its version and the protocol, and prints the version of libnex.
EXIT STATUS
run and attach return the exit code of the command; 255 for a NEX error or a lost node (LOST: unknown result). The other commands: 0 success, 1 error, 2 some node did not answer.
FILES
- /run/nex/agent.sock
- socket of the local agent.
SEE ALSO
nexsh(1), nexctl(8), nexagentd(8), /usr/share/doc/nex-cluster/en/utente.md, /usr/share/doc/nex-cluster/en/servizi.md
| November 2026 | nex 1.0.0~beta5 |