use cli version to stop app, cleanup output
This commit is contained in:
parent
dc2d476937
commit
5653613698
@ -34,25 +34,24 @@ do
|
|||||||
app=$(echo -e "$list" | grep ^"$selection)" | awk '{print $2}' | cut -c 4- )
|
app=$(echo -e "$list" | grep ^"$selection)" | awk '{print $2}' | cut -c 4- )
|
||||||
[[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && continue #Check for valid selection. If none, contiue
|
[[ -z "$app" ]] && echo "Invalid Selection: $selection, was not an option" && sleep 3 && continue #Check for valid selection. If none, contiue
|
||||||
pvc=$(echo -e "$list" | grep ^"$selection)")
|
pvc=$(echo -e "$list" | grep ^"$selection)")
|
||||||
|
|
||||||
|
#Stop applicaiton if not stopped
|
||||||
status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r")
|
status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r")
|
||||||
if [[ "$status" != "STOPPED" ]]; then
|
if [[ "$status" != "STOPPED" ]]; then
|
||||||
[[ -z $timeout ]] && echo -e "\nDefault Timeout: 500" && timeout=500 || echo -e "\nCustom Timeout: $timeout"
|
cli -c 'app chart_release scale release_name='\""$app"\"\ 'scale_options={"replica_count": 0}' &> /dev/null
|
||||||
SECONDS=0 && echo -e "\nScaling down $app" && midclt call chart.release.scale "$app" '{"replica_count": 0}' &> /dev/null
|
|
||||||
else
|
else
|
||||||
echo -e "\n$app is already stopped"
|
echo -e "\n$app is already stopped"
|
||||||
fi
|
fi
|
||||||
while [[ "$SECONDS" -le "$timeout" && "$status" != "STOPPED" ]]
|
|
||||||
do
|
#Grab data then output
|
||||||
status=$(cli -m csv -c 'app chart_release query name,status' | grep -E "^$app\b" | awk -F ',' '{print $2}'| tr -d " \t\n\r")
|
|
||||||
echo -e "Waiting $((timeout-SECONDS)) more seconds for $app to be STOPPED" && sleep 5
|
|
||||||
done
|
|
||||||
data_name=$(echo "$pvc" | awk '{print $3}')
|
data_name=$(echo "$pvc" | awk '{print $3}')
|
||||||
mount=$(echo "$pvc" | awk '{print $4}')
|
|
||||||
volume_name=$(echo "$pvc" | awk '{print $4}')
|
volume_name=$(echo "$pvc" | awk '{print $4}')
|
||||||
full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}')
|
full_path=$(zfs list | grep "$volume_name" | grep "$pool" | awk '{print $1}')
|
||||||
echo -e "\nMounting\n$full_path\nTo\n/mnt/heavyscript/$data_name"
|
echo -e "\nMounting\n$data_name"
|
||||||
zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app"
|
zfs set mountpoint=/heavyscript/"$data_name" "$full_path" || echo "Failed to mount $app"
|
||||||
echo -e "Mounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n"
|
echo -e "\nMounted\n\nUnmount with:\nzfs set mountpoint=legacy $full_path && rmdir /mnt/heavyscript/$data_name\n\nOr use the Unmount All option\n"
|
||||||
|
|
||||||
|
#Ask if user would like to mount something else
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
echo
|
echo
|
||||||
|
Loading…
Reference in New Issue
Block a user