paxtonhare / demo-magic

A handy shell script that enables you to write repeatable demos in a bash environment.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Continue demo in a newly created bash session

yuvalavra opened this issue · comments

Is there a way to continue the demo on a newly created bash session? Something like:

pei "ssh 10.0.0.1"
# Subsequent commands run in the ssh session
pei "hostname" 

Thanks

commented

I'm extra late to the party but if you ever still wonder, personally for a demo on k8s (I think you have similar situations 😄) I just copy demo magic, pv, and my demo magic script to the target, and execute, it's pretty transparent.

Typically something like this:

# dependencies
kubectl cp demo-magic $CHALL_POD_NAME:/tmp 
kubectl exec -it pod/$CHALL_POD_NAME -- mkdir -p /home/user/.bin
kubectl cp pv $CHALL_POD_NAME:/home/user/.bin/pv
# demo magic script
kubectl cp honk-pod.sh $CHALL_POD_NAME:/home/user/honk-pod.sh
# jump
kubectl exec -it pod/$CHALL_POD_NAME -- /home/user/honk-pod.sh -d

Just make sure that PV is in the path (in my case PATH=/home/user/.bin/:$PATH) before loading demo-magic.sh.

My example is a bit specific but you can simply and use scp and ssh instead of kubectl cp or kubectl exec.

thanks @mtardy for the answer.

@yuvalavra I just added an example for a non-kubernetes setup that would do what you want. It's under the samples/remote-exec directory.