Advertisement
sandervanvugt

trial script

Nov 4th, 2021
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. [root@rhel9 bash-scripting]# cat killthezombies.sh
  2. #!/bin/bash
  3.  
  4. if [ -z $1 ]
  5. then
  6. echo provide the name of the zombie to kill when running this script
  7. exit 11
  8. fi
  9.  
  10. ZOMBIES=$(ps aux | grep $1 | grep -v grep | awk '{ print $2 }')
  11.  
  12. echo DEBUG: zombies is $ZOMBIES
  13. echo press Enter to continue
  14. read
  15.  
  16. if [ -z $ZOMBIES ]
  17. then
  18. echo no work to do
  19. exit 12
  20. fi
  21.  
  22. kill -9 $ZOMBIES
  23. echo the zombies are now gone
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement