lackadaisical/calm
Sam Hardeman 160a7763b7 - Minor cleanup
- Change shebangs to use 'env' in prep for NixOS (and others)
- `agenda` now has a symlink to the underlying tree structure named ".tree"
- `binbox` has more checking, being prepped for automatic export of symlinks.
- `cdz` now symlinks to the archive directory using "<archive name>.tmp". This is less confusing than a randomized extraction folder, and adds the benefit of being in the FS-tree of the original archive.
- daisy.source changes:
> Added basic debug mode.
> `ched` can now set global (all of the shell) editor or local (lackadaisical utils only) editor.
> The encoding/decoding functions have been expanded and improved. Extra checking, permissions are stored as well, `daisy_dec` can handle stdin.
- Added new functions to manage lackadaisical config: daisy_backup (runs `bak` on config files), daisy_clear (removes config files), and daisy_restore (restores config files archived using bak).
- All functions/tools prefixed with 'daisy_' are now also available prefixed with 'ld_' instead
- Added a new utility, `clip`. This utility keeps a local variable that can be set if given args and get if no args are supplied. Basically a simple clipboard local to the ptty. Supports stdin.
2026-01-25 18:23:05 +01:00

41 lines
840 B
Bash
Executable file

#!/usr/bin/env bash
# Calm a process down
# NEEDS_WORK: cleanup
# calm <pid> == only one process
# calm <bin> == all processes that match query
# calm * == if used in proc or a folder with just PID files, if not you will get an error
# calm <pid> <bin> .... OK
# set's NICE value to 0
# need sudo
LD_INTERNAL=1
. $(dirname $(realpath $0))/daisy.source
pids=$@
errorFn()
{
echo calm: Invalid operation or no such PID/process \(\"$(echo "$pids" | tr '\n' ' ' | cut -c -20)...\"\)
exit
}
for pid in $pids
do
# Process to PID in elegant way
newpids=$(pidof "$pid")
if [ "$newpids" ]
then
binary=$pid
pid=$newpids
else
newbins=$pid
binary=$(ps -p "$pid" -o comm= 2>/dev/null )
if [ $? != 0 ]
then
errorFn
fi
fi
echo Calming down $pid \("$binary"\)...
sudo renice -n 0 -p $pid;
done