• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 388
  • Last Modified:

Killing remaining processes after a sudo SystemStarter stop "Name of script in startupitems"

Hi all,

Is here anyone that can help me with the following?

On MAC when I run sudo SystemStarter stop "Name of the script in startupitems" sometimes a process belonging to that program won't stop then I need to preform a manual kill of the process.

Does anyone know a script that after you use the SystemStarter stop command it does a

 
ps auxwww | grep ArchX

Open in new window


It looks at all the running processes of it and do a  
kill -9 pid

Open in new window

?
0
Silencer001
Asked:
Silencer001
  • 4
1 Solution
 
peter197911Commented:
I know in LInux / Unix i always used skill or killall to kill a process by name.

A few examples on kill commands:
http://linux.byexamples.com/archives/157/kill-process-with-care/
Not sure if this is all working on Mac
0
 
Silencer001Author Commented:
I want to automate this killing so that I can something like the following:
for pid in $(ps auxwww | grep ArchX)
do
  kill $pid
done

Open in new window

0
 
Silencer001Author Commented:
I finetuned this command, but it doesn't work on my MAC
 
#!/bin/bash

while [ 'ps auxwww | grep ArchX' ]
do
PIDS='ps auxwww | grep ArchX | awk '{print $1}''
echo "Killing " 'echo $PIDS | wc -w' " processes for user”
for PID in $PIDS
do
kill -9 $PID
done
done
echo "User has 0 processes still running."

Open in new window

0
 
Silencer001Author Commented:
This code works
 
#!/bin/sh

PIDS=`ps auxwww | grep ArchX | awk '{print $2}'` echo "Killing " `echo $PIDS | wc -w` " processes for user"
for PID in $PIDS
do
kill -9 $PID 2>&2 >/dev/null
done
echo "User has 0 processes still running."

Open in new window

0
 
Silencer001Author Commented:
100% working
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now