mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdctl: improve doc on etcdctl lock command
This commit is contained in:
parent
fb674833c2
commit
78d02f4229
@ -1056,7 +1056,7 @@ echo ${transferee_id}
|
|||||||
|
|
||||||
### LOCK [options] \<lockname\> [command arg1 arg2 ...]
|
### LOCK [options] \<lockname\> [command arg1 arg2 ...]
|
||||||
|
|
||||||
LOCK acquires a distributed named mutex with a given name. Once the lock is acquired, it will be held until etcdctl is terminated.
|
LOCK acquires a distributed mutex with a given name. Once the lock is acquired, it will be held until etcdctl is terminated.
|
||||||
|
|
||||||
#### Options
|
#### Options
|
||||||
|
|
||||||
@ -1064,9 +1064,9 @@ LOCK acquires a distributed named mutex with a given name. Once the lock is acqu
|
|||||||
|
|
||||||
#### Output
|
#### Output
|
||||||
|
|
||||||
Once the lock is acquired, the result for the GET on the unique lock holder key is displayed.
|
Once the lock is acquired but no command is given, the result for the GET on the unique lock holder key is displayed.
|
||||||
|
|
||||||
If a command is given, it will be launched with environment variables `ETCD_LOCK_KEY` and `ETCD_LOCK_REV` set to the lock's holder key and revision.
|
If a command is given, it will be executed with environment variables `ETCD_LOCK_KEY` and `ETCD_LOCK_REV` set to the lock's holder key and revision.
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
@ -1084,6 +1084,12 @@ Acquire lock and execute `echo lock acquired`:
|
|||||||
# lock acquired
|
# lock acquired
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Acquire lock and execute `etcdctl put` command
|
||||||
|
```bash
|
||||||
|
./etcdctl lock mylock ./etcdctl put foo bar
|
||||||
|
# OK
|
||||||
|
```
|
||||||
|
|
||||||
#### Remarks
|
#### Remarks
|
||||||
|
|
||||||
LOCK returns a zero exit code only if it is terminated by a signal and releases the lock.
|
LOCK returns a zero exit code only if it is terminated by a signal and releases the lock.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user