Register
It is currently Wed Oct 22, 2014 12:19 am

Stopping a service


All times are UTC - 6 hours


Post new topic Reply to topic  [ 3 posts ] 
Author Message
 PostPosted: Sun Jan 31, 2010 3:46 pm   

Joined: Fri May 16, 2008 4:58 am
Posts: 94
I want to be able to kill a service using my bash menu script, the process number isn't known to the script, i've tried

Code:
kill -9 `ps -aef | grep 'service' | grep -v grep | awk '{print $2}'`


but I think i've got a bit of it wrong somewhere, any ideas?


Top
 Profile  
 PostPosted: Sun Jan 31, 2010 4:53 pm   

Joined: Mon Mar 02, 2009 3:03 am
Posts: 550
Hi Brian,

did you try pkill, or pidof?


Top
 Profile  
 PostPosted: Thu Apr 01, 2010 1:52 pm   

Joined: Fri May 16, 2008 4:58 am
Posts: 94
I've got it to work via CLI using

Code:
kill -9 `ps ux | awk '/servicey/ && !/awk/ {print $2}'| grep -Ev $$`


But this doesn't work in a bash script any ideas what i'm doing wrong?


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP