test shell
This commit is contained in:
parent
03c16717cc
commit
0d30de9e22
@ -52,15 +52,48 @@ do
|
|||||||
done
|
done
|
||||||
container=$(echo "$containers" | grep ^"$selection)" | awk '{print $2}')
|
container=$(echo "$containers" | grep ^"$selection)" | awk '{print $2}')
|
||||||
container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}')
|
container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}')
|
||||||
clear -x
|
while true
|
||||||
title
|
do
|
||||||
echo "App Name: $app_name"
|
clear -x
|
||||||
echo "Container: $container"
|
title
|
||||||
echo
|
echo "App Name: $app_name"
|
||||||
echo "0) Exit"
|
echo "Container: $container"
|
||||||
read -rt 120 -p "What command would you like to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; }
|
echo
|
||||||
[[ $command == 0 ]] && echo "Exiting.." && exit
|
echo "1) Run a single command"
|
||||||
k3s crictl exec "$container_id" $command
|
echo "2) Open Shell"
|
||||||
container=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}')
|
echo
|
||||||
|
echo "0) Exit"
|
||||||
|
read -rt 120 -p "Please choose an option: " selection || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
|
case $selection in
|
||||||
|
0)
|
||||||
|
echo "Exiting.."
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
|
||||||
|
1)
|
||||||
|
clear -x
|
||||||
|
title
|
||||||
|
read -rt 120 -p "What command do you want to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||||
|
k3s crictl exec -it "$container_id" $command
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
|
||||||
|
2)
|
||||||
|
clear -x
|
||||||
|
title
|
||||||
|
|
||||||
|
if ! k3s crictl exec -it "$container_id" /bin/bash ; then
|
||||||
|
k3s crictl exec -it "$container_id" /bin/sh
|
||||||
|
fi
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "That was not an option.. Try again"
|
||||||
|
sleep 3
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
}
|
}
|
||||||
export -f cmd_to_container
|
export -f cmd_to_container
|
Loading…
Reference in New Issue
Block a user