top of page

KILL -9 MULTIPLE DUPLICATE PROCESSES(LINUX)

  • Writer: fredrickwer9
    fredrickwer9
  • Sep 22, 2018
  • 1 min read

######################################################### # cd /app/documentum/fwerescripts/monitoring && vi threads_monitor.sh && chmod 755 threads_monitor.sh #!/bin/bash

########################################################

#########################################################

docmonitor() {

echo "Monitoring running processes"

if [ $(ps -ef | grep -i docbasemonitor.sh| grep -v grep | wc -l) -ge 3 ]; then echo "Cleaning Needed"; ps -ef | grep -i dmadmin |grep -i docbasemonitor.sh |grep -v grep |sed -n '1!p' | awk '{print $2}' | xargs kill -9; sleep 2; else echo "Everything is fine"; fi

}

SLEEP() {

echo "Cleaning startup scripts" if [ $(ps -ef | grep -i dmadmin |grep -i startup_docbase.sh | grep -v grep| wc -l) -ge 3 ]; then echo "Cleaning needed"; ps -ef | grep -i dmadmin |grep -i startup_docbase.sh |grep -v grep |sed -n '1!p' | awk '{print $2}' | xargs kill -9; sleep 2; else echo "Everything is fine"; fi

}

SLEEP2() {

OUT2="`ps -ef | grep -i dmadmin |grep -i "sleep 2" | wc -l`"

if [ $OUT2 -gt 5 ]; then echo "Excess threads running : Cleaning them" ps -ef | grep -i "sleep 2" |grep -i "sleep 2" | awk '{print $2}' | xargs kill -9; sleep 2; ps -ef | grep -i "sleep 2" |grep -i "sleep 2" else echo "Everything Running Fine" fi

}

############################# #main script docmonitor SLEEP SLEEP2

 
 
 

Commentaires


©2018 by OPEN LINUX LEARNING. Proudly created with Wix.com

bottom of page