Better lockfile (don't complain when running multiple git-build)
This commit is contained in:
parent
744b3708df
commit
2a0b71dafa
13
git-build.sh
13
git-build.sh
|
@ -8,6 +8,10 @@
|
|||
|
||||
BASEDIR="$HOME/.git-build"
|
||||
|
||||
# So scripts can know we're still running (for autoupdater)
|
||||
echo "$BASHPID" > $BASEDIR/.LOCK
|
||||
|
||||
|
||||
# Default logging levels (error is always enabled)
|
||||
INFO=1
|
||||
DEBUG=0
|
||||
|
@ -72,10 +76,6 @@ run() {
|
|||
(GITBUILDCONF="$CONFDIR" GITBUILDDIR="$BASEDIR" nohup $BASEDIR/$p_name $p_name > $BASEDIR/$p_name.log 2>&1) &
|
||||
}
|
||||
|
||||
# So scripts can know we're still running (for autoupdater)
|
||||
# TODO needs to be reworked so multiple instances can run at the same time https://tildegit.org/southerntofu/git-build.sh/issues/13
|
||||
touch $BASEDIR/.LOCK
|
||||
|
||||
# Overriden by -f/--force to force rebuild when no update is available
|
||||
FORCE=0
|
||||
|
||||
|
@ -214,5 +214,8 @@ for p_name in ${PROJECTS[*]}; do
|
|||
fi
|
||||
done
|
||||
|
||||
# TODO: better locking mechanism
|
||||
# Check the PID in lockfile is still ours, we don't want
|
||||
# to remove the lockfile if another git-build "owns" it
|
||||
if [[ "$(cat $BASEDIR/.LOCK)" = "$BASHPID" ]]; then
|
||||
rm $BASEDIR/.LOCK
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue