#Random Scripts 4
#Desc:
clear
echo "1. To see all processes currently running on the system"
echo "2. To kill any given process"
echo "Choose between the two"
read x
case $x in
"1")print `ps aux`;;
"2") echo "Choose a process to be killed"
read y
check=`ps ax | grep $y`
echo $check;;
*) echo "You selected wrong option";;
esac
Two things :
(1). I need output when the user enters '1' same as we get when we run command "ps ax" on the comand line.
(2). I want to kill a process which user enters in the variable "Y". But the problem I am facing is I am not able to get how to check for the database session.
amitj:/home/fnb/amitj/scripts1> ps ax |grep isql
397410 pts/13 A 0:00 grep isql
495652 pts/15 A 0:00 isql -Utcs2dev -STCSDEV2 -� -c -w300
I will enter 'Utcs2dev' as variable in Y but then how to get the process ID from it , and then only I can use kill -9 PID.
Advise !