build(Makefile): make 'make log' work; mv containerfiles to .exited.

This commit is contained in:
Stephan Barth 2024-11-04 17:28:01 +01:00
parent bdca968818
commit 0437537824
2 changed files with 15 additions and 3 deletions

View File

@ -259,11 +259,21 @@ well-known: static;
status:
@./utils/develop-status.pl -a
# TODO: rework logs
# TODO: rework logs, because they do not work
.PHONY: log-%
# HELP(log-{database,memcached,minio,backend,frontend,hoogle}): inspect output of a given (currently running) service. When a service supports multiple running instances in one develop (i.e. backend), you need to specify the exact instance by its associated file (e.g. backend-1, backend-2, etc.), please check the contents of the develop/ directory for a list of running instances.
log-%:
$(CONTAINER_COMMAND) logs --follow `cat $(DEVELOP)/$* | grep CONTAINER_ID= | sed 's/^CONTAINER_ID=//'`
DEVELOP=develop/`cat develop/.current` ; \
SEARCH_FILE="$${DEVELOP}/$*" ; \
if [[ ! -e "$${SEARCH_FILE}" ]] ; then \
SEARCH_FILE="$${DEVELOP}/.exited.$*" ; \
fi ; \
if [[ -e "$${SEARCH_FILE}" ]] ; then \
$(CONTAINER_COMMAND) logs --follow `cat "$${SEARCH_FILE}" | grep CONTAINER_ID= | sed 's/^CONTAINER_ID=//'` ; \
else \
>&2 echo "Cannot show log: No develop file found for '$*'" ; \
exit 1 ; \
fi
.PHONY: enter
# HELP: launch (bash) shell inside a currently running container. Use ./enter shell wrapper for more convenient usage, possibly with tab-completion in the future

View File

@ -29,7 +29,9 @@ $STARTSCRIPT
while [ -e "$FILENAME" ] ; do
sleep 1
if ! $RUNNER ps --no-trunc | grep -q "$CONTAINER_ID" ; then
rm "$FILENAME"
#rm "$FILENAME"
EXITED_FILENAME=`echo "$FILENAME" | sed 's/\([^\/]*\)$/.exited.\1/'`
mv "$FILENAME" "$EXITED_FILENAME"
exit
fi
inotifywait -e ATTRIB -t 10 "$FILENAME" > /dev/null 2>/dev/null