• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 395
  • 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

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