Linux command
stormlock 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Acquire a lease
stormlock acquire [resource]
Acquire with explicit TTL
stormlock acquire --ttl [60s] [resource]
Release a lease
stormlock release [resource] [lease-id]
Renew an existing lease
stormlock renew [resource] [lease-id]
Show the current lease
stormlock current [resource]
Print only the lease id
stormlock current --id-only [resource]
Check whether a lease is still held
stormlock is-held [resource] [lease-id]
说明
stormlock is a simple centralized lock manager aimed at human operators and scripts that need occasional coordination (deployments, migrations, cron runs). Each lock is associated with a principal (who holds it) and a lease with a TTL that auto-expires, so a crashed holder cannot deadlock the resource. Typical flow: `stormlock acquire <resource>` prints a lease id; run the protected work; `stormlock release <resource> <lease-id>` when done. For long-running work, periodically call `stormlock renew` to extend the lease.
参数
- acquire _RESOURCE_ --ttl _DUR_
- Attempt to acquire a lease. On success prints the lease id.
- release _RESOURCE_ _LEASE_ID_
- Release the given lease on the given resource.
- renew _RESOURCE_ _LEASE_ID_ --ttl _DUR_
- Extend the lease duration.
- current _RESOURCE_ --id-only
- Show the current lease holder and id. `--id-only` prints only the id.
- is-held _RESOURCE_ _LEASE_ID_
- Exit with status 0 if the given lease is still active, non-zero otherwise.
- -c, --config _FILE_
- Path to the configuration file. Overrides `STORMLOCK_CONFIG`.
- --ttl _DURATION_
- Time-to-live for the lease (e.g. `30s`, `5m`, `1h`). Defaults come from the config file.
- --help
- Show help.
FAQ
What is the stormlock command used for?
stormlock is a simple centralized lock manager aimed at human operators and scripts that need occasional coordination (deployments, migrations, cron runs). Each lock is associated with a principal (who holds it) and a lease with a TTL that auto-expires, so a crashed holder cannot deadlock the resource. Typical flow: `stormlock acquire <resource>` prints a lease id; run the protected work; `stormlock release <resource> <lease-id>` when done. For long-running work, periodically call `stormlock renew` to extend the lease.
How do I run a basic stormlock example?
Run `stormlock acquire [resource]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does acquire _RESOURCE_ --ttl _DUR_ do in stormlock?
Attempt to acquire a lease. On success prints the lease id.