Skip to main content

Acquire lock

Take a named lock so no other agent run uses the same system at the same time. Optionally wait until the run holding it gives it back. The lock is given back by Release lock, or when this agent ends. With One CommandCenter the lock is shared by every runner; in OneAgentStudio on its own it works on this computer only.

Command in the Environment locks toolkit · id ooa.locks/acquire · 5 inputs (1 required), 2 outputs

Inputs​

InputTypeRequiredDefaultWhat it is
NameStringYesThe lock's name, e.g. SAP production login. Names are compared without case.
Wait (seconds)NumberNo0How long to wait for the lock when another run holds it; 0 tries once.
Lease (seconds)NumberNo3600How long the lock is held at most. After it, another run may take the lock. Acquire it again to renew the lease.
CommentStringNoWhy the lock is held, shown in One CommandCenter.
Fail if not acquiredBooleanNofalseFail with LOCK.TIMEOUT when the lock is not acquired, instead of returning acquired false.

Outputs​

OutputTypeWhat it is
acquiredBooleanTrue when this run now holds the lock.
held_byStringWhen not acquired: the run, runner and person holding it, and since when.