mekill=$(ps auxf --sort=+utime | grep -w "$ME" | grep -v -E 'color=auto|grep' | head -n 1 | awk '{ print $2 }')

This commit is contained in:
fred 2022-05-28 03:51:29 +02:00
parent 77bbe623ab
commit 920b2ba704
1 changed files with 1 additions and 1 deletions

View File

@ -16,7 +16,7 @@ ME="${0##*/}"
countMErunning=$(ps auxf --sort=+utime | grep -w "$ME" | grep -v -E 'color=auto|grep' | wc -l)
[[ $countMErunning -gt 2 ]] && \
echo "$ME already running. Killing old process" && \
mekill==$(ps auxf --sort=+utime | grep -w "$ME" | grep -v -E 'color=auto|grep' | head -n 1 | awk '{ print $2 }') && \
mekill=$(ps auxf --sort=+utime | grep -w "$ME" | grep -v -E 'color=auto|grep' | head -n 1 | awk '{ print $2 }') && \
kill -9 $mekill && \
exit 0