Better lockfile (don't complain when running multiple git-build)
This commit is contained in:
parent
744b3708df
commit
2a0b71dafa
15
git-build.sh
15
git-build.sh
|
@ -8,6 +8,10 @@
|
||||||
|
|
||||||
BASEDIR="$HOME/.git-build"
|
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)
|
# Default logging levels (error is always enabled)
|
||||||
INFO=1
|
INFO=1
|
||||||
DEBUG=0
|
DEBUG=0
|
||||||
|
@ -72,10 +76,6 @@ run() {
|
||||||
(GITBUILDCONF="$CONFDIR" GITBUILDDIR="$BASEDIR" nohup $BASEDIR/$p_name $p_name > $BASEDIR/$p_name.log 2>&1) &
|
(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
|
# Overriden by -f/--force to force rebuild when no update is available
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
|
||||||
|
@ -214,5 +214,8 @@ for p_name in ${PROJECTS[*]}; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# TODO: better locking mechanism
|
# Check the PID in lockfile is still ours, we don't want
|
||||||
rm $BASEDIR/.LOCK
|
# 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