Fix dockerctl unlocking
* replace $FDLOCK with correct file descriptor * do an unlock before attaching to a container – it never exits unless killed by supervisord * correctly redirect error message to stderr * remove /var/lock/dockerctl Closes-bug: 1513422 Change-Id: Idd70c381632e3dca7c24edab78a731dc03f363e1
This commit is contained in:
parent
ac0af2e12b
commit
0e98edbb19
|
@ -78,12 +78,13 @@ function debug {
|
|||
function lock {
|
||||
[[ $FLOCK -eq 1 ]] && return 0
|
||||
exec 904>/var/lock/dockerctl
|
||||
flock -n 904 || { echo 'Failed to acquire the lock.' &>2; exit 1; }
|
||||
flock -n 904 || { echo 'Failed to acquire the lock.' 1>&2; exit 1; }
|
||||
FLOCK=1
|
||||
}
|
||||
|
||||
function unlock {
|
||||
flock -u "$FDLOCK"
|
||||
flock -u 904
|
||||
rm -f /var/lock/dockerctl
|
||||
FLOCK=0
|
||||
}
|
||||
|
||||
|
@ -261,6 +262,7 @@ function start_container {
|
|||
supervisorctl start docker-$container > /dev/null
|
||||
fi
|
||||
if [ "$2" = "--attach" ]; then
|
||||
unlock
|
||||
attach_container $container_name
|
||||
fi
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue