Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (2)
Open lock files read-only and create if not exist
· b750a2ab
Bastian Blank
authored
May 20, 2018
b750a2ab
Merge branch 'lockfile-readonly' into 'master'
· 1d7b57e7
Joerg Jaspert
authored
May 20, 2018
Open lock files read-only and create if not exist See merge request
!54
1d7b57e7
Show whitespace changes
Inline
Side-by-side
config/debian/cronscript
View file @
1d7b57e7
...
...
@@ -223,9 +223,18 @@ function lock() {
LOCKFILE
=
${
!lvar
}
fi
# bash can't open a file read-only, while creating it,
# so we need to create it ourselves.
if
!
[[
-e
$LOCKFILE
]]
;
then
install
-m
444 /dev/null
$LOCKFILE
||
{
log_error
"Could not create lock
${
LOCKFILE
}
"
laststeps 2
}
fi
# Get filehandle
local
randomstring
exec
{
randomstring
}
<
>
${
LOCKFILE
}
exec
{
randomstring
}
<
${
LOCKFILE
}
# Store filehandle for later
LOCKFD[
${
LOCK
}
]=
${
randomstring
}
...
...