1
0
Fork 0
mirror of https://github.com/ciderale/nixos-utm.git synced 2024-12-14 11:37:37 +00:00

use pgrep for stopping utm

This commit is contained in:
Alain Lehmann 2024-12-01 00:19:35 +01:00
parent 6e5fd49d57
commit 37583c7afa

View file

@ -77,12 +77,13 @@
self'.packages.utm
pkgs.coreutils
pkgs.gnused
pkgs.ps
pkgs.procps
];
text = ''
# shellcheck disable=SC2009
if ps aux | grep '/[U]TM'; then
UTM_PID=$(ps ax -o pid,command | grep '/[U]TM'| sed -ne 's/^[ ]*\([[:digit:]]*\) .*/\1/p')
if pgrep '[U]TM'; then
echo "exists"
UTM_PID=$(pgrep '[U]TM')
read -r -e -p "Running at $UTM_PID. Kill? (y/N)" -i "n" answer
case "$answer" in
y | Y | yes ) kill "$UTM_PID" ;;