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