Heavybullets8/heavy_script

Add Option to stop all/several Applications at the same time

ChaosBlades opened this issue · 3 comments

The stop application menu only lets you stop single applications. Using 1-10 or 1,2,3,4 etc does not work. If you wanted to stop all applications or a select number at one time and you have over 30 this becomes very time consuming since you should not be using the stop function in SCALE according to TrueTool.

What's the purpose for stopping multiple/all applications?

Currently trying to solve an unscheduled reboot issue I am having with ix and they wanted me to try to replicate with all applications stopped and I realized that was not easy to do without using the stop function in the UI which TrueCharts does not advise you doing.

While the proposed feature isn't currently planned due to its limited scope beyond testing and bug tracing, the issue will remain open for anyone interested in implementing it. The potential solution could involve calling heavyscript app --stop * or a similar command.

In the meantime, here's a simple script you can use to stop each application:

#!/bin/bash

# Retrieve application names
mapfile -t apps < <(cli -m csv -c 'app chart_release query name' | tail -n +2 | sort | tr -d " \t\r" | awk 'NF')

# Stop each application with heavyscript stop function
for app in "${apps[@]}"; do
    heavyscript app --stop "$app"
    echo
done

echo "All applications have been stopped."

Make sure to adjust the heavyscript app --stop "$app" command to match your heavyscript installation path, if it wasn't installed with the one-liner. For example: bash /root/heavy_script/heavy_script.sh app --stop "$app".