This is an automated email from the ASF dual-hosted git repository.

roryqi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino-playground.git


The following commit(s) were added to refs/heads/main by this push:
     new 4512122  Delete old docker log files but keep the latest 3 (#124)
4512122 is described below

commit 4512122bf142f37af166b27ef10ab244f0d67289
Author: Vincent Chee Jia Hong <33974196+jhc...@users.noreply.github.com>
AuthorDate: Fri Jan 17 06:18:01 2025 +0000

    Delete old docker log files but keep the latest 3 (#124)
    
    This resolves https://github.com/apache/gravitino-playground/issues/123
---
 playground.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/playground.sh b/playground.sh
index e26c111..b1df4ee 100755
--- a/playground.sh
+++ b/playground.sh
@@ -165,6 +165,11 @@ checkPortsInUse() {
   fi
 }
 
+pruneLegacyLogs() {
+  # delete all log files except the latest 3
+  ls -tp playground-*.log | grep -v '/$' | tail -n +4 | xargs -I {} rm -- {}
+}
+
 start() {
   if [ "${enableRanger}" == true ]; then
     echo "[INFO] Starting the playground with Ranger..."
@@ -196,6 +201,7 @@ start() {
   fi
   ${dockerComposeCommand} -p ${playgroundRuntimeName} logs -f 
>${playground_dir}/playground-${logSuffix}.log 2>&1 &
   echo "[INFO] Check log details: 
${playground_dir}/playground-${logSuffix}.log"
+  pruneLegacyLogs
 }
 
 status() {

Reply via email to