build(Makefile): make 'make log' work; mv containerfiles to .exited.
This commit is contained in:
parent
bdca968818
commit
0437537824
14
Makefile
14
Makefile
@ -259,11 +259,21 @@ well-known: static;
|
|||||||
status:
|
status:
|
||||||
@./utils/develop-status.pl -a
|
@./utils/develop-status.pl -a
|
||||||
|
|
||||||
# TODO: rework logs
|
# TODO: rework logs, because they do not work
|
||||||
.PHONY: log-%
|
.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.
|
# 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-%:
|
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
|
.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
|
# HELP: launch (bash) shell inside a currently running container. Use ./enter shell wrapper for more convenient usage, possibly with tab-completion in the future
|
||||||
|
|||||||
@ -29,7 +29,9 @@ $STARTSCRIPT
|
|||||||
while [ -e "$FILENAME" ] ; do
|
while [ -e "$FILENAME" ] ; do
|
||||||
sleep 1
|
sleep 1
|
||||||
if ! $RUNNER ps --no-trunc | grep -q "$CONTAINER_ID" ; then
|
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
|
exit
|
||||||
fi
|
fi
|
||||||
inotifywait -e ATTRIB -t 10 "$FILENAME" > /dev/null 2>/dev/null
|
inotifywait -e ATTRIB -t 10 "$FILENAME" > /dev/null 2>/dev/null
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user