From 57a9027f3021b9cb1c5ab5d482e9c6796d6d789b Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Tue, 31 May 2016 06:00:17 +0200 Subject: [PATCH] feat(core): Add terminate script --- scripts/lemonbuddy_terminate.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 scripts/lemonbuddy_terminate.sh diff --git a/scripts/lemonbuddy_terminate.sh b/scripts/lemonbuddy_terminate.sh new file mode 100755 index 00000000..16b067ac --- /dev/null +++ b/scripts/lemonbuddy_terminate.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +read -p "Send SIGKILL to terminate processes? [Y/n] " -r choice + +[[ "${choice^^}" == "Y" ]] || { + echo "Aborting..." + exit +} + +[[ "${choice^^}" == "Y" ]] && { + pgrep -f "(lemonbuddy_wrapper.sh|^lemonb(uddy|ar))" | xargs kill -9 >/dev/null 2>&1 + + if [[ $? -eq 0 ]]; then + echo "Kill signals successfully sent" + else + echo "Failed to send kill signal ($?)" + fi +}