From 5aba4ecac2d27ec0df275d396640d17eeb3f9224 Mon Sep 17 00:00:00 2001 From: Frank Engel Date: Wed, 20 May 2026 07:45:08 +0200 Subject: [PATCH] ex06/ex07: writer als Daemon, exit mit Ctrl+C + Cleanup Co-Authored-By: Claude Sonnet 4.6 --- listings/exercises/ex06-bind-mount/commands.sh | 9 +++++---- listings/exercises/ex07-named-volume/commands.sh | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/listings/exercises/ex06-bind-mount/commands.sh b/listings/exercises/ex06-bind-mount/commands.sh index dc6f622..8bdcb1f 100755 --- a/listings/exercises/ex06-bind-mount/commands.sh +++ b/listings/exercises/ex06-bind-mount/commands.sh @@ -1,12 +1,13 @@ #!/bin/bash # Exercise 6 — Bind Mounts -# Terminal 1: write dates to /tmp/output -podman run -v /tmp:/data --rm -ti busybox \ +# Terminal 1: write dates to /tmp/output (detached) +podman run -d --name writer -v /tmp:/data busybox \ sh -c 'while true; do sleep 1; date >> /data/output; done' -# Terminal 2: watch the output -podman run -v /tmp:/data --rm busybox tail -f /data/output +# Terminal 2: watch the output (Ctrl+C to exit) +podman run --rm -v /tmp:/data busybox tail -f /data/output # Cleanup +podman stop writer && podman rm writer rm -f /tmp/output diff --git a/listings/exercises/ex07-named-volume/commands.sh b/listings/exercises/ex07-named-volume/commands.sh index 57510a4..3847552 100755 --- a/listings/exercises/ex07-named-volume/commands.sh +++ b/listings/exercises/ex07-named-volume/commands.sh @@ -3,12 +3,13 @@ podman volume create pizza -# Terminal 1: write dates into the volume -podman run -v pizza:/data --rm -ti busybox \ +# Terminal 1: write dates into the volume (detached) +podman run -d --name writer -v pizza:/data busybox \ sh -c 'while true; do sleep 1; date >> /data/output; done' -# Terminal 2: watch the output -podman run -v pizza:/data --rm busybox tail -f /data/output +# Terminal 2: watch the output (Ctrl+C to exit) +podman run --rm -v pizza:/data busybox tail -f /data/output # Cleanup +podman stop writer && podman rm writer podman volume rm pizza