Minor order of operations changes and var name consistency (lower-case)

This commit is contained in:
Sam Hardeman 2025-09-23 02:20:12 +02:00
parent 03303c9e36
commit 434a50987e
9 changed files with 236 additions and 208 deletions

20
calm
View file

@ -11,31 +11,31 @@
DAISY_INTERNAL=1
. $(dirname $(realpath $0))/daisy.source
PIDS=$@
pids=$@
errorFn()
{
echo calm: Invalid operation or no such PID/process \(\"$(echo "$PIDS" | tr '\n' ' ' | cut -c -20)...\"\)
echo calm: Invalid operation or no such PID/process \(\"$(echo "$pids" | tr '\n' ' ' | cut -c -20)...\"\)
exit
}
for pid in $PIDS
for pid in $pids
do
# Process to PID in elegant way
NEWPIDS=$(pidof "$pid")
if [ "$NEWPIDS" ]
newpids=$(pidof "$pid")
if [ "$newpids" ]
then
BINNY=$pid
pid=$NEWPIDS
binary=$pid
pid=$newpids
else
NEWBINS=$pid
BINNY=$(ps -p "$pid" -o comm= 2>/dev/null )
newbins=$pid
binary=$(ps -p "$pid" -o comm= 2>/dev/null )
if [ $? != 0 ]
then
errorFn
fi
fi
echo Calming down $pid \("$BINNY"\)...
echo Calming down $pid \("$binary"\)...
sudo renice -n 0 -p $pid;
done