composite/watch: improve this a little

This commit is contained in:
Franco Fichtner 2023-11-08 08:41:08 +01:00
parent 487cb2f282
commit 783ccad16f
1 changed files with 15 additions and 6 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Copyright (c) 2022 Franco Fichtner <franco@opnsense.org>
# Copyright (c) 2022-2023 Franco Fichtner <franco@opnsense.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@ -28,10 +28,19 @@
eval "$(make print-LOGSDIR)"
CURRENTDIR=$(find -s ${LOGSDIR} -type d -depth 1 \! -name latest | tail -n1)
LOGSTEP=${1}
if [ -n "${CURRENTDIR}" ]; then
for CURRENTLOG in $(find ${CURRENTDIR} -name "??-${1:-ports}.log"); do
tail -f ${CURRENTLOG}
break
done
if [ -z "${CURRENTDIR}" ]; then
echo "No logs were found"
return
fi
if [ -z "${LOGSTEP}" ]; then
find ${CURRENTDIR} -name "*.log"
return
fi
for CURRENTLOG in $(find ${CURRENTDIR} -name "??-${LOGSTEP}.log"); do
tail -f ${CURRENTLOG}
break
done