Guest User

stop continue process

a guest
Dec 12th, 2012
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.55 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # "stop" a process
  4. stop(){
  5.   if [ $# -ne 1 ]; then
  6.           echo 1>&2 Usage: stop process
  7.   else
  8.     PROCESS=$1
  9.     echo "Stopping processes with the word ${tGreen}$1${tReset}"
  10.     ps axw | grep -i $1 | awk -v PROC="$1" '{print $1}' | xargs kill -STOP
  11.   fi
  12. }
  13.  
  14. # "cont"inue a process
  15. cont(){
  16.   if [ $# -ne 1 ]; then
  17.           echo 1>&2 Usage: cont process
  18.   else
  19.     PROCESS=$1
  20.     echo "Continuing processes with the word ${tGreen}$1${tReset}"
  21.     ps axw | grep -i $1 | awk -v PROC="$1" '{print $1}' | xargs kill -CONT
  22.   fi
  23. }
Advertisement
Add Comment
Please, Sign In to add comment