April 24, 2014, 11:51:59 PM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: BASH SHELL SCRIPT  (Read 2022 times)

Offline nicksthegreat

  • New Member
  • Posts: 1
BASH SHELL SCRIPT
« on: April 06, 2004, 01:36:33 PM »
Hey guys,

           Can anyone write me a Bash Shell Script which kills all process of a specified user? It would be superb with some echo before after the main statement running. Hope you guys can help me out.

Cheers,
nicksthegreat

Offline sudipta_cht

  • Linux Noob !
  • *
  • Posts: 14
BASH SHELL SCRIPT
« Reply #1 on: April 08, 2004, 10:02:04 AM »
I will not write the entire thing out for you, but will give you kind of pseudocode
On your first line after #!/bin/sh
write
VARIABLE=`ps -aux | grep $1`
 where $1 is the user's id you supply at the command line
Next, the process ids are available in the second column of the output, and so a simple
cut -f 2
will yeild the proper process ids.
All that you now have to do is to run kill -HUP
for all these process ids.
Howzzzat?