diff --git a/ssh_router.sh b/ssh_router.sh index 338f20d..017fc1e 100644 --- a/ssh_router.sh +++ b/ssh_router.sh @@ -52,13 +52,16 @@ rw) fi check_devuser_attached + exit 0 ;; ro) - if ! podman container exists "$CONTAINER" || ! podman inspect -f '{{.State.Running}}' "$CONTAINER" | grep -q true; then - echo "❌ Container '$CONTAINER' not running." + if podman container exists "$CONTAINER" && podman inspect -f '{{.State.Running}}' "$CONTAINER" | grep -q true; then + exec podman exec -it --user "$VIEW_USER" "$CONTAINER" tmux attach -r -t "$TMUX_SESSION" + exit 0 + else + echo "❌ Container $CONTAINER does not exist." exit 1 fi - exec podman exec -it --user "$VIEW_USER" "$CONTAINER" tmux attach -r -t "$TMUX_SESSION" ;; *) echo "❌ Invalid access mode: $MODE"