remove indents, test sleep timer async
This commit is contained in:
parent
f3e66e9327
commit
721dadf09e
@ -2,9 +2,9 @@
|
||||
|
||||
|
||||
cmd_to_container(){
|
||||
app_name=$(k3s kubectl get pods -A | awk '{print $1}' | sort -u | grep -v "system" | sed '1d' | sed 's/^[^-]*-//' | nl -s ") " | column -t)
|
||||
while true
|
||||
do
|
||||
app_name=$(k3s kubectl get pods -A | awk '{print $1}' | sort -u | grep -v "system" | sed '1d' | sed 's/^[^-]*-//' | nl -s ") " | column -t)
|
||||
while true
|
||||
do
|
||||
clear -x
|
||||
title
|
||||
echo "$app_name"
|
||||
@ -21,18 +21,18 @@ cmd_to_container(){
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}')
|
||||
search=$(k3s crictl ps -a -s running)
|
||||
mapfile -t pod_id < <(echo "$search" | grep -E " $app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $9}')
|
||||
[[ "${#pod_id[@]}" == 0 ]] && echo -e "No containers available\nAre you sure the application in running?" && exit
|
||||
containers=$(
|
||||
for pod in "${pod_id[@]}"
|
||||
do
|
||||
done
|
||||
app_name=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}')
|
||||
search=$(k3s crictl ps -a -s running)
|
||||
mapfile -t pod_id < <(echo "$search" | grep -E " $app_name([[:space:]]|-([-[:alnum:]])*[[:space:]])" | awk '{print $9}')
|
||||
[[ "${#pod_id[@]}" == 0 ]] && echo -e "No containers available\nAre you sure the application in running?" && exit
|
||||
containers=$(
|
||||
for pod in "${pod_id[@]}"
|
||||
do
|
||||
echo "$search" | grep "$pod" | awk '{print $7}'
|
||||
done | nl -s ") " | column -t)
|
||||
while true
|
||||
do
|
||||
done | nl -s ") " | column -t)
|
||||
while true
|
||||
do
|
||||
clear -x
|
||||
title
|
||||
echo "$containers"
|
||||
@ -49,18 +49,18 @@ cmd_to_container(){
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
container=$(echo "$containers" | grep ^"$selection)" | awk '{print $2}')
|
||||
container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}')
|
||||
clear -x
|
||||
title
|
||||
echo "App Name: $app_name"
|
||||
echo "Container: $container"
|
||||
echo
|
||||
echo "0) Exit"
|
||||
read -rt 120 -p "What command would you like to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||
[[ $command == 0 ]] && echo "Exiting.." && exit
|
||||
k3s crictl exec "$container_id" $command
|
||||
container=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}')
|
||||
done
|
||||
container=$(echo "$containers" | grep ^"$selection)" | awk '{print $2}')
|
||||
container_id=$(echo "$search" | grep -E "[[:space:]]${container}[[:space:]]" | awk '{print $1}')
|
||||
clear -x
|
||||
title
|
||||
echo "App Name: $app_name"
|
||||
echo "Container: $container"
|
||||
echo
|
||||
echo "0) Exit"
|
||||
read -rt 120 -p "What command would you like to run?: " command || { echo -e "\nFailed to make a selection in time" ; exit; }
|
||||
[[ $command == 0 ]] && echo "Exiting.." && exit
|
||||
k3s crictl exec "$container_id" $command
|
||||
container=$(echo -e "$app_name" | grep ^"$selection)" | awk '{print $2}')
|
||||
}
|
||||
export -f cmd_to_container
|
@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
script_create(){
|
||||
while true
|
||||
do
|
||||
while true
|
||||
do
|
||||
clear -x
|
||||
title
|
||||
echo "Choose Your Update Type"
|
||||
@ -67,9 +67,9 @@ script_create(){
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
done
|
||||
while true
|
||||
do
|
||||
done
|
||||
while true
|
||||
do
|
||||
clear -x
|
||||
title
|
||||
echo "Update Options"
|
||||
@ -169,6 +169,6 @@ script_create(){
|
||||
echo "\"$current_selection\" was not an option, try again" && sleep 3 && continue
|
||||
;;
|
||||
esac
|
||||
done
|
||||
done
|
||||
}
|
||||
export -f script_create
|
@ -30,15 +30,16 @@ do
|
||||
do
|
||||
update_apps "${array[$it]}" &
|
||||
processes+=($!)
|
||||
sleep 2
|
||||
((it++))
|
||||
((proc_count++))
|
||||
done
|
||||
((ttl++))
|
||||
if [[ $ttl -eq 1 ]]; then
|
||||
sleep 15
|
||||
else
|
||||
sleep 6
|
||||
fi
|
||||
# ((ttl++))
|
||||
# if [[ $ttl -eq 1 ]]; then
|
||||
# sleep 15
|
||||
# else
|
||||
# sleep 6
|
||||
# fi
|
||||
elif [[ $proc_count != 0 ]]; then # Wait for all processes to finish
|
||||
sleep 6
|
||||
else # All processes must be completed, break out of loop
|
||||
|
Loading…
Reference in New Issue
Block a user