Filter out units which are not service or the user instance

pull/350/head
Colin Kuebler 2019-10-31 18:27:12 -04:00
parent 73a344f043
commit 1b02f66e2c
1 changed files with 1 additions and 1 deletions

View File

@ -62,7 +62,7 @@ check_port () {
echo "Aborting due to occupied port"
exit 1
else
service=$(ps -p "$process_pid" -o unit=)
service=$(ps -p "$process_pid" -o unit= | grep .service | grep -Ev ^user)
if [ -n "$service" ]; then
echo "Attempting to stop $service"
sudo systemctl stop "$service"