Casvisor
Assets

Jobs

Jobs (/jobs) run the same thing on many servers at once: a command, a script, or a file to copy onto them. They work on SSH assets, Linux and Windows, over the account stored on the asset, with nothing installed on the servers. The page is for administrators.

Starting a job

New job asks for:

FieldMeaning
NameOptional, such as Check disk space, to find the job in the list.
TypeCommand, Script or File transfer.
Assets, Asset tagsThe assets to run on, by name, and every SSH asset that has one of the tags when the job starts. Only SSH assets can run jobs; assets of other protocols with a tag are left out. The form shows the assets the job will run on.
CommandFor a command: one command line.
Script type, ScriptFor a script: Bash or PowerShell, and the script.
File, Target pathFor a file transfer: the file, uploaded to Casvisor first, up to 1 GB, and where to put it.
Timeout (seconds)How long each asset may take, 60 by default and at most a day. An asset still running after it is stopped.
ConcurrencyHow many assets run at the same time, 10 by default and at most 100.

Run on N assets starts it. The job runs in the background, so the page can be closed.

How each type runs

Casvisor connects to each asset over SSH as the asset's own account, through its network gateway when it has one, finds out whether it is Linux or Unix (with uname -s) or Windows, and then:

  • Command: on Linux and Unix, runs it with sh -c; on Windows, hands it to the OpenSSH server's shell, cmd unless PowerShell has been made the default.
  • Bash script: feeds the script to bash -s on the asset. A Windows asset fails with a message to pick PowerShell.
  • PowerShell script: uploads the script over SFTP, to /tmp on Linux and C:\ProgramData\Casvisor\run on Windows, runs it with powershell on Windows or pwsh on Linux, and deletes it afterwards.
  • File transfer: copies the file over SFTP. A target path ending in /, or naming a folder that exists, gets the file with its own name inside; any other path is the file's new name. Missing folders are created, and an existing file is overwritten. Windows paths such as C:\temp\a.txt work.

On Linux, when the asset has the timeout command, the command runs under it, so the timeout also stops the processes it started. Otherwise the command is signalled and the connection cut when the time is up.

A command or script succeeds when it exits with 0, and a file transfer when the file is written. The account needs the rights for what the job does; for anything that needs root, use sudo in the command, which works without a password prompt only if the account may run it so.

Following a job

The list shows each job's name, type, status, how many of its assets succeeded and failed, who started it, when, and how long it took. Its page shows, for each asset, the status, the exit code, how long it took, the error and the output, which is updated every few seconds while it runs. Up to the last 1 MB of output is kept per asset.

StatusMeaning
PendingNot started yet, waiting for a free slot.
RunningRunning now.
SucceededExit code 0, or the file was written.
FailedAnother exit code, or an error such as a failed login.
Timed outStopped at the timeout.
BlockedStopped by a command rule before it ran.
CanceledStopped by Cancel job, or not reached before it.
InterruptedCasvisor was restarted while it ran.

A job is Succeeded when every asset succeeded, and Failed otherwise.

On a job's page:

  • Cancel job stops what is running and skips the assets not reached yet.
  • Rerun failed runs the job again, in place, on the assets that did not succeed.
  • Run as new job opens a new job with the same settings, to change and run.

A job can be deleted once it is not running, with its results and its uploaded file. A file uploaded for a job that was never started is removed when Casvisor starts, once it is a day old.

Rules, sessions and logs

  • Before a command or script runs on an asset, each of its lines is checked against the command rules that apply to the administrator who started the job and to that asset. A Block rule marks the asset Blocked and nothing is run there; an Alert rule lets it run and flags it.
  • The command or script is recorded as one command record for each asset. A file transfer is recorded as sftp put <file> <target path>.
  • Each asset's run is a session of its own, with the mode job and the user agent Casvisor job, and stopping that session stops the job on that asset. Jobs have no recordings; their output is on the job's page.
  • Starting, rerunning, cancelling and deleting jobs go into the operation log, as start-job, rerun-job, cancel-job and delete-job.

Jobs are run by administrators and are not subject to permissions. For installing system updates, use Patch management, which knows about Windows Update and the Linux package managers.

Edit on GitHub

On this page