ex06/ex07: writer als Daemon, exit mit Ctrl+C + Cleanup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bd046e626d
commit
5aba4ecac2
2 changed files with 10 additions and 8 deletions
|
|
@ -1,12 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Exercise 6 — Bind Mounts
|
# Exercise 6 — Bind Mounts
|
||||||
|
|
||||||
# Terminal 1: write dates to /tmp/output
|
# Terminal 1: write dates to /tmp/output (detached)
|
||||||
podman run -v /tmp:/data --rm -ti busybox \
|
podman run -d --name writer -v /tmp:/data busybox \
|
||||||
sh -c 'while true; do sleep 1; date >> /data/output; done'
|
sh -c 'while true; do sleep 1; date >> /data/output; done'
|
||||||
|
|
||||||
# Terminal 2: watch the output
|
# Terminal 2: watch the output (Ctrl+C to exit)
|
||||||
podman run -v /tmp:/data --rm busybox tail -f /data/output
|
podman run --rm -v /tmp:/data busybox tail -f /data/output
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
|
podman stop writer && podman rm writer
|
||||||
rm -f /tmp/output
|
rm -f /tmp/output
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,13 @@
|
||||||
|
|
||||||
podman volume create pizza
|
podman volume create pizza
|
||||||
|
|
||||||
# Terminal 1: write dates into the volume
|
# Terminal 1: write dates into the volume (detached)
|
||||||
podman run -v pizza:/data --rm -ti busybox \
|
podman run -d --name writer -v pizza:/data busybox \
|
||||||
sh -c 'while true; do sleep 1; date >> /data/output; done'
|
sh -c 'while true; do sleep 1; date >> /data/output; done'
|
||||||
|
|
||||||
# Terminal 2: watch the output
|
# Terminal 2: watch the output (Ctrl+C to exit)
|
||||||
podman run -v pizza:/data --rm busybox tail -f /data/output
|
podman run --rm -v pizza:/data busybox tail -f /data/output
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
|
podman stop writer && podman rm writer
|
||||||
podman volume rm pizza
|
podman volume rm pizza
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue