手動刪除AP、DB Process的scripts

在關機的時候,常常會有ERP無法自行將使用者所屬的Process刪除,此時都是以手動下達Kill指令。
但是當數量很多時,一筆一筆的刪除會耗費不少的時間,所以寫了Script來一次完成。

#Description: Force to kill defunct database user process
#Created By: KEVEN
#Created Date: 2013/07/26

#!/bin/sh

#force to kill defunct database user process

echo "Are you sure force to kill DB Process?(y/n) \c"
read vcheck

if [ $vcheck = "y" ] && [ -n $vcheck ]; then

  pid2=`ps -ef | grep oraclePROD | grep -v "grep" | grep -v "root" | grep -v "DESCRIPTION"  | awk '{print $2}'`

  for j in $pid2
  do
    kill -9 $j
  done

  echo "Task Completed!"

else

  echo "User Cancel."

fi

------------------------------------------------------------------------------

#Description: Force to kill defunct application user process
#Created By: KEVEN
#Created Date: 2013/07/26

#!/bin/sh

#force to kill defunct application user process

echo "Are you sure force to kill AP Process?(y/n) \c"
read vcheck

if [ $vcheck = "y" ] && [ -n $vcheck ]; then

  pid=`ps -ef | grep prodmgr | grep -v "grep" | grep -v "root" | awk '{print $2}'`

  for i in $pid
  do
    kill -9 $i    
  done

  echo "Task Completed!"

else

  echo "User Cancel."

fi